pub struct RouteChaosInjector { /* private fields */ }Expand description
Per-route fault and latency injector
Implementations§
Source§impl RouteChaosInjector
impl RouteChaosInjector
Sourcepub fn new(routes: Vec<RouteConfig>) -> Result<Self>
pub fn new(routes: Vec<RouteConfig>) -> Result<Self>
Create a new route chaos injector
Sourcepub fn should_inject_fault(
&self,
method: &Method,
uri: &Uri,
) -> Option<RouteFaultInjectionResult>
pub fn should_inject_fault( &self, method: &Method, uri: &Uri, ) -> Option<RouteFaultInjectionResult>
Check if a fault should be injected for this request
Sourcepub async fn inject_latency(&self, method: &Method, uri: &Uri) -> Result<()>
pub async fn inject_latency(&self, method: &Method, uri: &Uri) -> Result<()>
Inject latency for this request
Sourcepub fn get_fault_response(
&self,
method: &Method,
uri: &Uri,
) -> Option<RouteFaultResponse>
pub fn get_fault_response( &self, method: &Method, uri: &Uri, ) -> Option<RouteFaultResponse>
Get fault injection response for a request
Trait Implementations§
Source§impl Clone for RouteChaosInjector
impl Clone for RouteChaosInjector
Source§fn clone(&self) -> RouteChaosInjector
fn clone(&self) -> RouteChaosInjector
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 moreAuto Trait Implementations§
impl Freeze for RouteChaosInjector
impl RefUnwindSafe for RouteChaosInjector
impl Send for RouteChaosInjector
impl Sync for RouteChaosInjector
impl Unpin for RouteChaosInjector
impl UnwindSafe for RouteChaosInjector
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more