Struct tower::balance::p2c::MakeBalance[][src]

pub struct MakeBalance<S, Req> { /* fields omitted */ }
This is supported on crate feature balance only.

Constructs load balancers over dynamic service sets produced by a wrapped “inner” service.

This is effectively an implementation of MakeService except that it forwards the service descriptors (Target) to an inner service (S), and expects that service to produce a service set in the form of a Discover. It then wraps the service set in a Balance before returning it as the “made” service.

See the module-level documentation for details on load balancing.


impl<S, Req> MakeBalance<S, Req>[src]

pub fn new(make_discover: S) -> Self[src]

Build balancers using operating system entropy.

Trait Implementations

impl<S: Clone, Req: Clone> Clone for MakeBalance<S, Req>[src]

impl<S: Debug, Req: Debug> Debug for MakeBalance<S, Req>[src]

impl<S, Target, Req> Service<Target> for MakeBalance<S, Req> where
    S: Service<Target>,
    S::Response: Discover,
    <S::Response as Discover>::Key: Hash,
    <S::Response as Discover>::Service: Service<Req>,
    <<S::Response as Discover>::Service as Service<Req>>::Error: Into<BoxError>, 

type Response = Balance<S::Response, Req>

Responses given by the service.

type Error = S::Error

Errors produced by the service.

type Future = MakeFuture<S::Future, Req>

The future response value.

Auto Trait Implementations

impl<S, Req> RefUnwindSafe for MakeBalance<S, Req> where
    S: RefUnwindSafe

impl<S, Req> Send for MakeBalance<S, Req> where
    S: Send

impl<S, Req> Sync for MakeBalance<S, Req> where
    S: Sync

impl<S, Req> Unpin for MakeBalance<S, Req> where
    S: Unpin

impl<S, Req> UnwindSafe for MakeBalance<S, Req> where
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, Request> ServiceExt<Request> for T where
    T: Service<Request> + ?Sized

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,