pub struct ErrorLayer<'a, D, G> { /* private fields */ }
Available on crate feature
error
only.Expand description
Layer that randomly trigger errors for the service.
This trigger errors based on the given probability and using a function to generate errors.
Implementations§
Source§impl<'a> ErrorLayer<'a, (), ()>
impl<'a> ErrorLayer<'a, (), ()>
Source§impl<'a, D, G> ErrorLayer<'a, D, G>
impl<'a, D, G> ErrorLayer<'a, D, G>
Sourcepub fn new(decider: D, generator: G) -> Self
pub fn new(decider: D, generator: G) -> Self
Create a new ErrorLayer
builder with the given probability
and error generator.
Sourcepub fn with_decider<ND>(self, decider: ND) -> ErrorLayer<'a, ND, G>
pub fn with_decider<ND>(self, decider: ND) -> ErrorLayer<'a, ND, G>
Set the given decider to be used to determine if an error should be injected.
Sourcepub fn with_generator<NG>(self, generator: NG) -> ErrorLayer<'a, D, NG>
pub fn with_generator<NG>(self, generator: NG) -> ErrorLayer<'a, D, NG>
Set the given error generator to generate errors.
Trait Implementations§
Source§impl<'a, D: Clone, G: Clone> Clone for ErrorLayer<'a, D, G>
impl<'a, D: Clone, G: Clone> Clone for ErrorLayer<'a, D, G>
Source§fn clone(&self) -> ErrorLayer<'a, D, G>
fn clone(&self) -> ErrorLayer<'a, D, G>
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, D, G, S> Layer<S> for ErrorLayer<'a, D, G>
impl<'a, D, G, S> Layer<S> for ErrorLayer<'a, D, G>
Auto Trait Implementations§
impl<'a, D, G> Freeze for ErrorLayer<'a, D, G>
impl<'a, D, G> RefUnwindSafe for ErrorLayer<'a, D, G>where
D: RefUnwindSafe,
G: RefUnwindSafe,
impl<'a, D, G> Send for ErrorLayer<'a, D, G>
impl<'a, D, G> Sync for ErrorLayer<'a, D, G>
impl<'a, D, G> Unpin for ErrorLayer<'a, D, G>
impl<'a, D, G> UnwindSafe for ErrorLayer<'a, D, G>where
D: UnwindSafe,
G: 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