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

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.

Implementations

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
[src]

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.

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

Yields the next discovery change set.

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

Auto Trait Implementations

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

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

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

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

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<K, S, E, D> Discover for D where
    D: TryStream<Ok = Change<K, S>, Error = E> + ?Sized,
    K: Eq
[src]

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>, 
[src]

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

impl<T> StreamExt for T where
    T: Stream + ?Sized
[src]

impl<St> StreamExt for St where
    St: Stream + ?Sized
[src]

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

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
[src]

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