[][src]Struct tower_balance::pool::Pool

pub struct Pool<MS, Target, Request> where
    MS: MakeService<Target, Request>,
    MS::MakeError: Into<Box<dyn Error + Send + Sync>>,
    MS::Error: Into<Box<dyn Error + Send + Sync>>,
    Target: Clone
{ /* fields omitted */ }

A dynamically sized, load-balanced pool of Service instances.

Methods

impl<MS, Target, Request> Pool<MS, Target, Request> where
    MS: MakeService<Target, Request>,
    MS::Service: Load,
    <MS::Service as Load>::Metric: Debug,
    MS::MakeError: Into<Box<dyn Error + Send + Sync>>,
    MS::Error: Into<Box<dyn Error + Send + Sync>>,
    Target: Clone
[src]

pub fn new(make_service: MS, target: Target) -> Self[src]

Construct a new dynamically sized Pool.

If many calls to poll_ready return Pending, new_service is used to construct another Service that is then added to the load-balanced pool. If many calls to poll_ready succeed, the most recently added Service is dropped from the pool.

Trait Implementations

impl<MS, Target, Request> Debug for Pool<MS, Target, Request> where
    MS: MakeService<Target, Request> + Debug,
    MS::MakeError: Into<Box<dyn Error + Send + Sync>>,
    MS::Error: Into<Box<dyn Error + Send + Sync>>,
    Target: Clone + Debug,
    MS::Service: Debug,
    Request: Debug
[src]

impl<MS, Target, Req> Service<Req> for Pool<MS, Target, Req> where
    MS: MakeService<Target, Req>,
    MS::Service: Load,
    <MS::Service as Load>::Metric: Debug,
    MS::MakeError: Into<Box<dyn Error + Send + Sync>>,
    MS::Error: Into<Box<dyn Error + Send + Sync>>,
    Target: Clone
[src]

type Response = <Balance<Pin<Box<PoolDiscoverer<MS, Target, Req>>>, Req> as Service<Req>>::Response

Responses given by the service.

type Error = <Balance<Pin<Box<PoolDiscoverer<MS, Target, Req>>>, Req> as Service<Req>>::Error

Errors produced by the service.

type Future = <Balance<Pin<Box<PoolDiscoverer<MS, Target, Req>>>, Req> as Service<Req>>::Future

The future response value.

Auto Trait Implementations

impl<MS, Target, Request> !RefUnwindSafe for Pool<MS, Target, Request>

impl<MS, Target, Request> Send for Pool<MS, Target, Request> where
    MS: Send,
    Request: Send,
    Target: Send,
    <MS as MakeService<Target, Request>>::Future: Send,
    <MS as MakeService<Target, Request>>::Service: Send

impl<MS, Target, Request> Sync for Pool<MS, Target, Request> where
    MS: Sync,
    Request: Sync,
    Target: Sync,
    <MS as MakeService<Target, Request>>::Future: Sync,
    <MS as MakeService<Target, Request>>::Service: Sync

impl<MS, Target, Request> Unpin for Pool<MS, Target, Request> where
    Request: Unpin

impl<MS, Target, Request> !UnwindSafe for Pool<MS, Target, Request>

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<M, S, Target, Request> MakeService<Target, Request> for M where
    M: Service<Target, Response = S>,
    S: Service<Request>, 
[src]

type Response = <S as Service<Request>>::Response

Responses given by the service

type Error = <S as Service<Request>>::Error

Errors produced by the service

type Service = S

The Service value created by this factory

type MakeError = <M as Service<Target>>::Error

Errors produced while building a service.

type Future = <M as Service<Target>>::Future

The future of the Service instance.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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>,