pub struct ErrorLayer<'a, F> { /* private fields */ }
Available on crate feature
error
only.Expand description
A 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, F> ErrorLayer<'a, F>
impl<'a, F> ErrorLayer<'a, F>
Sourcepub fn new(probability: f64, func: F) -> Result<Self, Error>
pub fn new(probability: f64, func: F) -> Result<Self, Error>
Create a new ErrorLayer
with the given probability and error function.
The probability is the chance that a request will result in an error, bound between 0 and 1. A probability of 0.5 means that 50% of the calls to the service will result in an error.
Trait Implementations§
Source§impl<'a, F: Clone> Clone for ErrorLayer<'a, F>
impl<'a, F: Clone> Clone for ErrorLayer<'a, F>
Source§fn clone(&self) -> ErrorLayer<'a, F>
fn clone(&self) -> ErrorLayer<'a, F>
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, F: Debug> Debug for ErrorLayer<'a, F>
impl<'a, F: Debug> Debug for ErrorLayer<'a, F>
Auto Trait Implementations§
impl<'a, F> Freeze for ErrorLayer<'a, F>where
F: Freeze,
impl<'a, F> RefUnwindSafe for ErrorLayer<'a, F>where
F: RefUnwindSafe,
impl<'a, F> Send for ErrorLayer<'a, F>where
F: Send,
impl<'a, F> Sync for ErrorLayer<'a, F>where
F: Sync,
impl<'a, F> Unpin for ErrorLayer<'a, F>where
F: Unpin,
impl<'a, F> UnwindSafe for ErrorLayer<'a, F>where
F: 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