Struct Constant
pub struct Constant<T, M> { /* private fields */ }
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>
const fn new(inner: T, load: M) -> SelfWraps a
T-typed service with a constantM-typed load metric.
Trait Implementations
impl<'__pin, T, M> Unpin for Constant<T, M>
where
PinnedFieldsOf<__Origin<'__pin, T, M>>: Unpin,
impl<D: Discover + Unpin, M: Copy> Stream for Constant<D, M>
type Item = Result<Change<<D as Discover>::Key, Constant<<D as Discover>::Service, M>>, <D as Discover>::Error>;fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>Yields the next discovery change set.
impl<S, M, Request> Service<Request> for Constant<S, M>
where
S: Service<Request>,
M: Copy,
type Response = <S as Service<Request>>::Response;type Error = <S as Service<Request>>::Error;type Future = <S as Service<Request>>::Future;fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>fn call(&mut self, req: Request) -> Self::Future
impl<T, M: Copy + PartialOrd> Load for Constant<T, M>
type Metric = M;fn load(&self) -> M
impl<T: Debug, M: Debug> Debug for Constant<T, M>
fn fmt(&self, f: &mut Formatter<'_>) -> Result