pub struct FaultChannelConfig {
pub reorder_probability: f64,
pub reorder_buffer_size: usize,
pub duplication_probability: f64,
pub seed: u64,
}Expand description
Configuration for channel fault injection.
Fields§
§reorder_probability: f64Probability of buffering a message for reorder [0.0, 1.0].
reorder_buffer_size: usizeMaximum reorder buffer size. When full, the buffer is flushed in a random permutation.
duplication_probability: f64Probability of duplicating a message [0.0, 1.0].
seed: u64Deterministic seed for the PRNG.
Implementations§
Source§impl FaultChannelConfig
impl FaultChannelConfig
Sourcepub const fn new(seed: u64) -> Self
pub const fn new(seed: u64) -> Self
Create a new config with the given seed and no faults enabled.
Sourcepub fn with_reorder(self, probability: f64, buffer_size: usize) -> Self
pub fn with_reorder(self, probability: f64, buffer_size: usize) -> Self
Enable reorder injection with the given probability and buffer size.
§Panics
Panics if probability is not in [0.0, 1.0] or buffer_size is 0.
Sourcepub fn with_duplication(self, probability: f64) -> Self
pub fn with_duplication(self, probability: f64) -> Self
Enable duplication injection with the given probability.
§Panics
Panics if probability is not in [0.0, 1.0].
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns true if any fault injection is enabled.
Trait Implementations§
Source§impl Clone for FaultChannelConfig
impl Clone for FaultChannelConfig
Source§fn clone(&self) -> FaultChannelConfig
fn clone(&self) -> FaultChannelConfig
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 FaultChannelConfig
impl RefUnwindSafe for FaultChannelConfig
impl Send for FaultChannelConfig
impl Sync for FaultChannelConfig
impl Unpin for FaultChannelConfig
impl UnsafeUnpin for FaultChannelConfig
impl UnwindSafe for FaultChannelConfig
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: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).