diff --git a/tower-util/Cargo.toml b/tower-util/Cargo.toml index b9ad486..215a643 100644 --- a/tower-util/Cargo.toml +++ b/tower-util/Cargo.toml @@ -22,14 +22,20 @@ Utilities for working with `Service`. categories = ["asynchronous", "network-programming"] edition = "2018" +[features] +call-all = ["futures-util"] + [dependencies] tower-service = "0.3" pin-project = "0.4" -futures-util = "0.3" -futures-core = "0.3" +futures-core = { version = "0.3", default-features = false } + +# Optional + +futures-util = { version = "0.3", optional = true, default-features = false } [dev-dependencies] tokio-test = "0.2" -tokio = { version = "0.2", features = ["stream", "sync", "macros"] } +tokio = { version = "0.2", features = ["stream", "sync", "macros"] } tower = { version = "0.3", path = "../tower" } tower-test = { version = "0.3", path = "../tower-test" } diff --git a/tower-util/src/either.rs b/tower-util/src/either.rs index 9240529..62428aa 100644 --- a/tower-util/src/either.rs +++ b/tower-util/src/either.rs @@ -2,7 +2,7 @@ //! //! See `Either` documentation for more details. -use futures_util::ready; +use futures_core::ready; use pin_project::{pin_project, project}; use std::{ future::Future, diff --git a/tower-util/src/lib.rs b/tower-util/src/lib.rs index e1c444d..2237e7d 100644 --- a/tower-util/src/lib.rs +++ b/tower-util/src/lib.rs @@ -10,6 +10,7 @@ //! Various utility types and functions that are generally with Tower. mod boxed; +#[cfg(feature = "call-all")] mod call_all; mod either; mod oneshot; @@ -20,7 +21,6 @@ mod service_fn; pub use crate::{ boxed::{BoxService, UnsyncBoxService}, - call_all::{CallAll, CallAllUnordered}, either::Either, oneshot::Oneshot, optional::Optional, @@ -28,6 +28,9 @@ pub use crate::{ service_fn::{service_fn, ServiceFn}, }; +#[cfg(feature = "call-all")] +pub use crate::call_all::{CallAll, CallAllUnordered}; + pub mod error { //! Error types diff --git a/tower-util/src/oneshot.rs b/tower-util/src/oneshot.rs index aa1b00c..6f6e809 100644 --- a/tower-util/src/oneshot.rs +++ b/tower-util/src/oneshot.rs @@ -1,4 +1,4 @@ -use futures_util::ready; +use futures_core::ready; use pin_project::{pin_project, project}; use std::{ fmt, diff --git a/tower-util/src/optional/future.rs b/tower-util/src/optional/future.rs index 5312a58..8d8848b 100644 --- a/tower-util/src/optional/future.rs +++ b/tower-util/src/optional/future.rs @@ -1,5 +1,5 @@ use super::{error, Error}; -use futures_util::ready; +use futures_core::ready; use pin_project::pin_project; use std::{ future::Future, diff --git a/tower-util/src/ready.rs b/tower-util/src/ready.rs index 44cb38a..29272b8 100644 --- a/tower-util/src/ready.rs +++ b/tower-util/src/ready.rs @@ -1,6 +1,6 @@ use std::{fmt, marker::PhantomData}; -use futures_util::ready; +use futures_core::ready; use std::{ future::Future, pin::Pin, diff --git a/tower/Cargo.toml b/tower/Cargo.toml index d36cd16..80cb808 100644 --- a/tower/Cargo.toml +++ b/tower/Cargo.toml @@ -36,7 +36,7 @@ tower-load-shed = { version = "0.3", path = "../tower-load-shed" } tower-retry = { version = "0.3", path = "../tower-retry" } tower-service = "0.3" tower-timeout = { version = "0.3", path = "../tower-timeout" } -tower-util = { version = "0.3", path = "../tower-util" } +tower-util = { version = "0.3", path = "../tower-util", features = ["call-all"] } futures-core = "0.3" [dev-dependencies]