[][src]Struct tower_load::Constant

pub struct Constant<T, M> { /* fields omitted */ }

Wraps a type so that Load::load returns a constant value.

Methods

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<D: Discover + Unpin, M: Copy> Discover for Constant<D, M>[src]

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

type Key = D::Key

NewService key

type Service = Constant<D::Service, M>

The type of Service yielded by this Discover.

type Error = D::Error

Error produced during discovery

fn poll_discover(
    self: Pin<&mut Self>,
    cx: &mut Context
) -> Poll<Result<Change<D::Key, Self::Service>, D::Error>>
[src]

Yields the next discovery change set.

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

type Metric = M

A comparable load metric. Lesser values are "preferable" to greater values.

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

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
[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<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.