From 1ff81a4ef109d9453ea150a3ff63720a9d28ef3a Mon Sep 17 00:00:00 2001 From: Amos Wenger Date: Tue, 19 Mar 2024 16:49:32 +0100 Subject: [PATCH] feat: futures => futures_util (fewer deps) closes #78 --- Cargo.lock | 54 +------------------------ rc-zip-tokio/Cargo.toml | 2 +- rc-zip-tokio/src/read_zip.rs | 4 +- rc-zip-tokio/tests/integration_tests.rs | 2 +- 4 files changed, 5 insertions(+), 57 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 65e8eaf..f2c5446 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -306,54 +306,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - [[package]] name = "futures-core" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" -[[package]] -name = "futures-executor" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - [[package]] name = "futures-macro" version = "0.3.30" @@ -365,12 +323,6 @@ dependencies = [ "syn", ] -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - [[package]] name = "futures-task" version = "0.3.30" @@ -383,13 +335,9 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ - "futures-channel", "futures-core", - "futures-io", "futures-macro", - "futures-sink", "futures-task", - "memchr", "pin-project-lite", "pin-utils", "slab", @@ -865,7 +813,7 @@ dependencies = [ name = "rc-zip-tokio" version = "4.0.1" dependencies = [ - "futures", + "futures-util", "oval", "pin-project-lite", "positioned-io", diff --git a/rc-zip-tokio/Cargo.toml b/rc-zip-tokio/Cargo.toml index 437485a..01680ec 100644 --- a/rc-zip-tokio/Cargo.toml +++ b/rc-zip-tokio/Cargo.toml @@ -20,7 +20,7 @@ path = "src/lib.rs" rc-zip = { version = "5.0.1", path = "../rc-zip" } positioned-io = { version = "0.3.3" } tokio = { version = "1.35.1", features = ["fs", "io-util", "rt-multi-thread"] } -futures = { version = "0.3.30" } +futures-util = { version = "0.3.30" } pin-project-lite = { version = "0.2.13" } oval = "2.0.0" tracing = "0.1.40" diff --git a/rc-zip-tokio/src/read_zip.rs b/rc-zip-tokio/src/read_zip.rs index 7794e9f..8f11737 100644 --- a/rc-zip-tokio/src/read_zip.rs +++ b/rc-zip-tokio/src/read_zip.rs @@ -6,7 +6,7 @@ use std::{ task::{Context, Poll}, }; -use futures::future::BoxFuture; +use futures_util::future::BoxFuture; use positioned_io::{RandomAccessFile, ReadAt, Size}; use tokio::io::{AsyncRead, AsyncReadExt, ReadBuf}; @@ -344,7 +344,7 @@ impl AsyncRead for AsyncRandomAccessFileCursor { self.poll_read(cx, buf) } ARAFCState::Reading { fut } => { - let core = futures::ready!(fut + let core = futures_util::ready!(fut .as_mut() .poll(cx) .map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))??); diff --git a/rc-zip-tokio/tests/integration_tests.rs b/rc-zip-tokio/tests/integration_tests.rs index fe8071d..c26f129 100644 --- a/rc-zip-tokio/tests/integration_tests.rs +++ b/rc-zip-tokio/tests/integration_tests.rs @@ -101,7 +101,7 @@ where buf: &mut ReadBuf<'_>, ) -> task::Poll> { let mut inner_buf = buf.take(1); - futures::ready!( + futures_util::ready!( unsafe { self.map_unchecked_mut(|s| &mut s.0) }.poll_read(cx, &mut inner_buf) )?; let n = inner_buf.filled().len();