pub struct LatencyInjector { /* private fields */ }
Expand description
Latency and fault injector
Implementations§
Source§impl LatencyInjector
impl LatencyInjector
Sourcepub fn new(latency_profile: LatencyProfile, fault_config: FaultConfig) -> Self
pub fn new(latency_profile: LatencyProfile, fault_config: FaultConfig) -> Self
Create a new latency injector
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable injection
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if injection is enabled
Sourcepub async fn inject_latency(&self, tags: &[String]) -> Result<()>
pub async fn inject_latency(&self, tags: &[String]) -> Result<()>
Inject latency for a request
Sourcepub fn should_inject_failure(&self) -> bool
pub fn should_inject_failure(&self) -> bool
Check if a failure should be injected
Sourcepub fn get_failure_response(&self) -> (u16, Option<Value>)
pub fn get_failure_response(&self) -> (u16, Option<Value>)
Get failure response details
Trait Implementations§
Source§impl Clone for LatencyInjector
impl Clone for LatencyInjector
Source§fn clone(&self) -> LatencyInjector
fn clone(&self) -> LatencyInjector
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 Debug for LatencyInjector
impl Debug for LatencyInjector
Auto Trait Implementations§
impl Freeze for LatencyInjector
impl RefUnwindSafe for LatencyInjector
impl Send for LatencyInjector
impl Sync for LatencyInjector
impl Unpin for LatencyInjector
impl UnwindSafe for LatencyInjector
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