Struct tower_load::Constant [−][src]
Wraps a type so that Load::load
returns a constant value.
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<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]
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Result<Change<D::Key, Self::Service>, D::Error>>
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.
fn load(&self) -> M
[src]
impl<T, M> PinnedDrop for Constant<T, M>
[src]
impl<S, M, Request> Service<Request> for Constant<S, M> where
S: Service<Request>,
M: Copy,
[src]
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.
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
[src]
fn call(&mut self, req: Request) -> Self::Future
[src]
impl<'pin, T, M> Unpin for Constant<T, M> where
__Constant<'pin, T, M>: Unpin,
[src]
__Constant<'pin, T, M>: Unpin,
impl<T, M> UnsafeUnpin for Constant<T, M>
[src]
Auto Trait Implementations
impl<T, M> RefUnwindSafe for Constant<T, M> where
M: RefUnwindSafe,
T: RefUnwindSafe,
M: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, M> Send for Constant<T, M> where
M: Send,
T: Send,
M: Send,
T: Send,
impl<T, M> Sync for Constant<T, M> where
M: Sync,
T: Sync,
M: Sync,
T: Sync,
impl<T, M> UnwindSafe for Constant<T, M> where
M: UnwindSafe,
T: UnwindSafe,
M: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,