Struct tower::load::Constant[][src]

pub struct Constant<T, M> { /* fields omitted */ }
This is supported on crate feature load only.

Wraps a type so that it implements Load and returns a constant load metric.

This load estimator is primarily useful for testing.


impl<T, M: Copy> Constant<T, M>[src]

pub fn new(inner: T, load: M) -> Self[src]

Wraps a T-typed service with a constant M-typed load metric.

Trait Implementations

impl<T: Debug, M: Debug> Debug for Constant<T, M>[src]

impl<T, M: Copy + PartialOrd> Load for Constant<T, M>[src]

type Metric = M

A comparable load metric. Read more

impl<S, M, Request> Service<Request> for Constant<S, M> where
    S: Service<Request>,
    M: Copy

type Response = S::Response

Responses given by the service.

type Error = S::Error

Errors produced by the service.

type Future = S::Future

The future response value.

impl<D: Discover + Unpin, M: Copy> Stream for Constant<D, M>[src]

This is supported on crate feature discover only.

Proxies Discover such that all changes are wrapped with a constant load.

type Item = Result<Change<D::Key, Constant<D::Service, M>>, D::Error>

Values yielded by the stream.

fn poll_next(
    self: Pin<&mut Self>,
    cx: &mut Context<'_>
) -> Poll<Option<Self::Item>>

Yields the next discovery change set.

impl<'pin, T, M> Unpin for Constant<T, M> where
    __Constant<'pin, T, M>: Unpin

Auto Trait Implementations

impl<T, M> RefUnwindSafe for Constant<T, M> where
    M: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, M> Send for Constant<T, M> where
    M: Send,
    T: Send

impl<T, M> Sync for Constant<T, M> where
    M: Sync,
    T: Sync

impl<T, M> UnwindSafe for Constant<T, M> where
    M: UnwindSafe,
    T: 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<K, S, E, D> Discover for D where
    D: TryStream<Ok = Change<K, S>, Error = E> + ?Sized,
    K: Eq

type Key = K

This is supported on crate feature discover only.

A unique identifier for each active service. Read more

type Service = S

This is supported on crate feature discover only.

The type of Service yielded by this Discover. Read more

type Error = E

This is supported on crate feature discover only.

Error produced during discovery

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> StreamExt for T where
    T: Stream + ?Sized

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<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<S> TryStreamExt for S where
    S: TryStream + ?Sized

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