pub struct FailureInjector { /* private fields */ }
Expand description
Enhanced failure injector with tag filtering and error rates
Implementations§
Source§impl FailureInjector
impl FailureInjector
Sourcepub fn new(config: Option<FailureConfig>, enabled: bool) -> Self
pub fn new(config: Option<FailureConfig>, enabled: bool) -> Self
Create a new failure injector
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if failure injection is enabled globally
Sourcepub fn should_inject_failure(&self, tags: &[String]) -> bool
pub fn should_inject_failure(&self, tags: &[String]) -> bool
Determine if a failure should be injected for the given tags
Sourcepub fn get_failure_response(&self, tags: &[String]) -> Option<(u16, String)>
pub fn get_failure_response(&self, tags: &[String]) -> Option<(u16, String)>
Get failure response details for the given tags
Sourcepub fn process_request(&self, tags: &[String]) -> Option<(u16, String)>
pub fn process_request(&self, tags: &[String]) -> Option<(u16, String)>
Process a request with failure injection Returns Some((status_code, error_message)) if failure should be injected, None otherwise
Sourcepub fn update_config(&mut self, config: Option<FailureConfig>)
pub fn update_config(&mut self, config: Option<FailureConfig>)
Update the failure configuration
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable failure injection
Trait Implementations§
Source§impl Clone for FailureInjector
impl Clone for FailureInjector
Source§fn clone(&self) -> FailureInjector
fn clone(&self) -> FailureInjector
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 FailureInjector
impl Debug for FailureInjector
Auto Trait Implementations§
impl Freeze for FailureInjector
impl RefUnwindSafe for FailureInjector
impl Send for FailureInjector
impl Sync for FailureInjector
impl Unpin for FailureInjector
impl UnwindSafe for FailureInjector
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