chore: update dependencies
This commit is contained in:
parent
1e25e7dd69
commit
fcaf6c7e30
9 changed files with 136 additions and 165 deletions
|
|
@ -5,7 +5,7 @@ use crate::{
|
|||
spawn_detached::spawn_detached,
|
||||
tab,
|
||||
};
|
||||
use cosmic::iced::futures::{SinkExt, channel::mpsc::Sender};
|
||||
use cosmic::iced::futures::{self, SinkExt, StreamExt, channel::mpsc::Sender, stream};
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fmt::Formatter,
|
||||
|
|
@ -200,23 +200,25 @@ pub async fn sync_to_disk(
|
|||
written_files: Vec<PathBuf>,
|
||||
target_dirs: std::collections::HashSet<PathBuf>,
|
||||
) {
|
||||
use futures::{StreamExt, stream};
|
||||
|
||||
// Sync files to disk
|
||||
let file_stream = stream::iter(written_files.into_iter().map(|path| async move {
|
||||
stream::iter(written_files.into_iter().map(|path| async move {
|
||||
if let Ok(file) = compio::fs::OpenOptions::new().write(true).open(&path).await {
|
||||
let _ = file.sync_all().await;
|
||||
}
|
||||
}));
|
||||
file_stream.buffer_unordered(32).collect::<Vec<_>>().await;
|
||||
}))
|
||||
.buffer_unordered(32)
|
||||
.collect::<Vec<_>>()
|
||||
.await;
|
||||
|
||||
// Sync directories to disk
|
||||
let dir_stream = stream::iter(target_dirs.into_iter().map(|path| async move {
|
||||
stream::iter(target_dirs.into_iter().map(|path| async move {
|
||||
if let Ok(dir) = compio::fs::OpenOptions::new().read(true).open(&path).await {
|
||||
let _ = dir.sync_all().await;
|
||||
}
|
||||
}));
|
||||
dir_stream.buffer_unordered(16).collect::<Vec<_>>().await;
|
||||
}))
|
||||
.buffer_unordered(16)
|
||||
.collect::<Vec<_>>()
|
||||
.await;
|
||||
}
|
||||
|
||||
fn copy_unique_path(from: &Path, to: &Path) -> PathBuf {
|
||||
|
|
@ -1208,7 +1210,7 @@ mod tests {
|
|||
path::PathBuf,
|
||||
};
|
||||
|
||||
use cosmic::iced::futures::{StreamExt, channel::mpsc};
|
||||
use cosmic::iced::futures::{StreamExt, channel::mpsc, future};
|
||||
use log::debug;
|
||||
use test_log::test;
|
||||
use tokio::sync;
|
||||
|
|
@ -1262,7 +1264,7 @@ mod tests {
|
|||
}
|
||||
};
|
||||
|
||||
futures::future::join(handle_messages, handle_copy).await.1
|
||||
future::join(handle_messages, handle_copy).await.1
|
||||
}
|
||||
|
||||
#[test(compio::test)]
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ impl OpReader {
|
|||
|
||||
impl io::Read for OpReader {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
futures::executor::block_on(async {
|
||||
cosmic::iced::futures::executor::block_on(async {
|
||||
self.controller
|
||||
.check()
|
||||
.await
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ impl Op {
|
|||
}
|
||||
}
|
||||
|
||||
let (from_file, metadata, mut to_file) = futures::try_join!(
|
||||
let (from_file, metadata, mut to_file) = cosmic::iced::futures::try_join!(
|
||||
async {
|
||||
compio::fs::OpenOptions::new()
|
||||
.read(true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue