tower-util: reduce dependencies, make call-all optional

This commit is contained in:
Sean McArthur 2019-12-11 09:53:19 -08:00
parent 1843416dfe
commit f130e5e113
7 changed files with 18 additions and 9 deletions

View File

@ -22,14 +22,20 @@ Utilities for working with `Service`.
categories = ["asynchronous", "network-programming"] categories = ["asynchronous", "network-programming"]
edition = "2018" edition = "2018"
[features]
call-all = ["futures-util"]
[dependencies] [dependencies]
tower-service = "0.3" tower-service = "0.3"
pin-project = "0.4" pin-project = "0.4"
futures-util = "0.3" futures-core = { version = "0.3", default-features = false }
futures-core = "0.3"
# Optional
futures-util = { version = "0.3", optional = true, default-features = false }
[dev-dependencies] [dev-dependencies]
tokio-test = "0.2" 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 = { version = "0.3", path = "../tower" }
tower-test = { version = "0.3", path = "../tower-test" } tower-test = { version = "0.3", path = "../tower-test" }

View File

@ -2,7 +2,7 @@
//! //!
//! See `Either` documentation for more details. //! See `Either` documentation for more details.
use futures_util::ready; use futures_core::ready;
use pin_project::{pin_project, project}; use pin_project::{pin_project, project};
use std::{ use std::{
future::Future, future::Future,

View File

@ -10,6 +10,7 @@
//! Various utility types and functions that are generally with Tower. //! Various utility types and functions that are generally with Tower.
mod boxed; mod boxed;
#[cfg(feature = "call-all")]
mod call_all; mod call_all;
mod either; mod either;
mod oneshot; mod oneshot;
@ -20,7 +21,6 @@ mod service_fn;
pub use crate::{ pub use crate::{
boxed::{BoxService, UnsyncBoxService}, boxed::{BoxService, UnsyncBoxService},
call_all::{CallAll, CallAllUnordered},
either::Either, either::Either,
oneshot::Oneshot, oneshot::Oneshot,
optional::Optional, optional::Optional,
@ -28,6 +28,9 @@ pub use crate::{
service_fn::{service_fn, ServiceFn}, service_fn::{service_fn, ServiceFn},
}; };
#[cfg(feature = "call-all")]
pub use crate::call_all::{CallAll, CallAllUnordered};
pub mod error { pub mod error {
//! Error types //! Error types

View File

@ -1,4 +1,4 @@
use futures_util::ready; use futures_core::ready;
use pin_project::{pin_project, project}; use pin_project::{pin_project, project};
use std::{ use std::{
fmt, fmt,

View File

@ -1,5 +1,5 @@
use super::{error, Error}; use super::{error, Error};
use futures_util::ready; use futures_core::ready;
use pin_project::pin_project; use pin_project::pin_project;
use std::{ use std::{
future::Future, future::Future,

View File

@ -1,6 +1,6 @@
use std::{fmt, marker::PhantomData}; use std::{fmt, marker::PhantomData};
use futures_util::ready; use futures_core::ready;
use std::{ use std::{
future::Future, future::Future,
pin::Pin, pin::Pin,

View File

@ -36,7 +36,7 @@ tower-load-shed = { version = "0.3", path = "../tower-load-shed" }
tower-retry = { version = "0.3", path = "../tower-retry" } tower-retry = { version = "0.3", path = "../tower-retry" }
tower-service = "0.3" tower-service = "0.3"
tower-timeout = { version = "0.3", path = "../tower-timeout" } 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" futures-core = "0.3"
[dev-dependencies] [dev-dependencies]