From fde3521cce837e60e6b5e15f19fc181eb1929f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Fri, 18 Oct 2019 22:24:42 -0400 Subject: [PATCH] deps: bump async_std --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- src/content/write.rs | 12 ++++++------ src/index.rs | 5 ++--- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d1269d4..831a2c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,7 +28,7 @@ dependencies = [ [[package]] name = "async-std" -version = "0.99.9" +version = "0.99.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "async-macros 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -39,7 +39,7 @@ dependencies = [ "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", "futures-io-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-timer 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "kv-log-macro 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -173,7 +173,7 @@ name = "cacache" version = "2.0.1" dependencies = [ "async-attributes 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "async-std 0.99.9 (registry+https://github.com/rust-lang/crates.io-index)", + "async-std 0.99.10 (registry+https://github.com/rust-lang/crates.io-index)", "chownr 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -444,7 +444,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-timer" -version = "0.4.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1085,7 +1085,7 @@ dependencies = [ "checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" "checksum async-attributes 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5266d863e013ece9c8793b69fe6d3a70679f7adea32c92d0aa5eb6e2a55d4d06" "checksum async-macros 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e421d59b24c1feea2496e409b3e0a8de23e5fc130a2ddc0b012e551f3b272bba" -"checksum async-std 0.99.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e274b0689dffa49d9c128a7bd1a86707b6bc8ea319af0899caae654e221656f4" +"checksum async-std 0.99.10 (registry+https://github.com/rust-lang/crates.io-index)" = "78e8ea9961931e674433891032bb92e7d5f43ab59f9c0ff77da140eb76de39de" "checksum async-task 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de6bd58f7b9cc49032559422595c81cbfcf04db2f2133592f70af19e258a1ced" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" @@ -1129,7 +1129,7 @@ dependencies = [ "checksum futures-io-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "f4914ae450db1921a56c91bde97a27846287d062087d4a652efc09bb3a01ebda" "checksum futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3b1dce2a0267ada5c6ff75a8ba864b4e679a9e2aa44262af7a3b5516d530d76e" "checksum futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "86f148ef6b69f75bb610d4f9a2336d4fc88c4b5b67129d1a340dd0fd362efeec" -"checksum futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "878f1d2fc31355fa02ed2372e741b0c17e58373341e6a122569b4623a14a7d33" +"checksum futures-timer 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2879f3aa8fd2f60d17ede13349e11d0c132d0daa1b44e061f133f8928ddfaeea" "checksum futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "5ce968633c17e5f97936bd2797b6e38fb56cf16a7422319f7ec2e30d3c470e8d" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" "checksum getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "473a1265acc8ff1e808cd0a1af8cee3c2ee5200916058a2ca113c29f2d903571" diff --git a/Cargo.toml b/Cargo.toml index 58a5b7d..a3eb4e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ walkdir = "2.2.7" either = "1.5.2" mkdirp = "1.0.0" futures-preview = "0.3.0-alpha.18" -async-std = { version = "0.99.9", features = ["unstable"]} +async-std = { version = "0.99.10", features = ["unstable"]} [target.'cfg(unix)'.dependencies] chownr = "2.0.0" diff --git a/src/content/write.rs b/src/content/write.rs index c066580..4ce6324 100644 --- a/src/content/write.rs +++ b/src/content/write.rs @@ -6,7 +6,7 @@ use std::sync::Mutex; use async_std::fs as afs; use async_std::future::Future; -use async_std::task::{blocking, Context, JoinHandle, Poll}; +use async_std::task::{self, Context, JoinHandle, Poll}; use futures::io::AsyncWrite; use futures::prelude::*; use ssri::{Algorithm, Integrity, IntegrityOpts}; @@ -91,7 +91,7 @@ impl AsyncWriter { Ok(AsyncWriter(Mutex::new(State::Idle(Some(Inner { cache: cache_path, builder: IntegrityOpts::new().algorithm(algo), - tmpfile: blocking(async move { NamedTempFile::new_in(tmp_path) }).await?, + tmpfile: task::spawn_blocking(|| NamedTempFile::new_in(tmp_path) ).await?, buf: vec![], last_op: None, }))))) @@ -115,7 +115,7 @@ impl AsyncWriter { let cpath = path::content_path(&inner.cache, &sri); // Start the operation asynchronously. - *state = State::Busy(blocking(async move { + *state = State::Busy(task::spawn(async move { let res = afs::DirBuilder::new() .recursive(true) // Safe unwrap. cpath always has multiple segments @@ -186,7 +186,7 @@ impl AsyncWrite for AsyncWriter { inner.buf[..buf.len()].copy_from_slice(buf); // Start the operation asynchronously. - *state = State::Busy(blocking(async move { + *state = State::Busy(task::spawn_blocking(|| { inner.builder.input(&inner.buf); let res = inner.tmpfile.write(&inner.buf); inner.last_op = Some(Operation::Write(res)); @@ -220,7 +220,7 @@ impl AsyncWrite for AsyncWriter { let mut inner = opt.take().unwrap(); // Start the operation asynchronously. - *state = State::Busy(blocking(async move { + *state = State::Busy(task::spawn_blocking(|| { let res = inner.tmpfile.flush(); inner.last_op = Some(Operation::Flush(res)); State::Idle(Some(inner)) @@ -247,7 +247,7 @@ impl AsyncWrite for AsyncWriter { }; // Start the operation asynchronously. - *state = State::Busy(blocking(async move { + *state = State::Busy(task::spawn_blocking(|| { drop(inner); State::Idle(None) })); diff --git a/src/index.rs b/src/index.rs index 364f80b..e2d6423 100644 --- a/src/index.rs +++ b/src/index.rs @@ -5,8 +5,7 @@ use std::io::{ErrorKind, Write}; use std::path::{Path, PathBuf}; use std::time::{SystemTime, UNIX_EPOCH}; -use async_std::fs as afs; -use async_std::task::blocking; +use async_std::{fs as afs, task}; #[cfg(unix)] use chownr; use digest::Digest; @@ -104,7 +103,7 @@ pub async fn insert_async<'a>( let tmpbucket = bucket.clone(); #[cfg(unix)] let PutOpts { uid, gid, .. } = opts; - blocking(async move { + task::spawn_blocking(move || { let parent = tmpbucket.parent().unwrap(); #[cfg(unix)] {