pub struct LatencyLayer<'a, De, Di> { /* private fields */ }Available on crate feature
latency only.Expand description
Layer that randomly adds latency to the service.
Note: This does not add latency to the underlying service, but rather ensure that the service will have a minimal latency (set by the distribution) before returning a response.
Implementations§
Source§impl<'a> LatencyLayer<'a, (), ()>
impl<'a> LatencyLayer<'a, (), ()>
Source§impl<'a, De, Di> LatencyLayer<'a, De, Di>
impl<'a, De, Di> LatencyLayer<'a, De, Di>
Sourcepub fn new(decider: De, distribution: Di) -> Self
pub fn new(decider: De, distribution: Di) -> Self
Create a new LatencyLayer builder with the given probability
and latency distribution.
Sourcepub fn with_decider<NDe>(self, decider: NDe) -> LatencyLayer<'a, NDe, Di>
pub fn with_decider<NDe>(self, decider: NDe) -> LatencyLayer<'a, NDe, Di>
Set the given decider to be used to determine if a latency should be injected.
Sourcepub fn with_distribution<NDi>(
self,
distribution: NDi,
) -> LatencyLayer<'a, De, NDi>
pub fn with_distribution<NDi>( self, distribution: NDi, ) -> LatencyLayer<'a, De, NDi>
Set the given latency distribution to set the latency.
Trait Implementations§
Source§impl<'a, De: Clone, Di: Clone> Clone for LatencyLayer<'a, De, Di>
impl<'a, De: Clone, Di: Clone> Clone for LatencyLayer<'a, De, Di>
Source§fn clone(&self) -> LatencyLayer<'a, De, Di>
fn clone(&self) -> LatencyLayer<'a, De, Di>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a, De, Di, S> Layer<S> for LatencyLayer<'a, De, Di>
impl<'a, De, Di, S> Layer<S> for LatencyLayer<'a, De, Di>
Auto Trait Implementations§
impl<'a, De, Di> Freeze for LatencyLayer<'a, De, Di>
impl<'a, De, Di> RefUnwindSafe for LatencyLayer<'a, De, Di>where
De: RefUnwindSafe,
Di: RefUnwindSafe,
impl<'a, De, Di> Send for LatencyLayer<'a, De, Di>
impl<'a, De, Di> Sync for LatencyLayer<'a, De, Di>
impl<'a, De, Di> Unpin for LatencyLayer<'a, De, Di>
impl<'a, De, Di> UnwindSafe for LatencyLayer<'a, De, Di>where
De: UnwindSafe,
Di: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more