[−][src]Struct smoltcp::phy::FaultInjector
A fault injector device.
A fault injector is a device that alters packets traversing through it to simulate adverse network conditions (such as random packet loss or corruption), or software or hardware limitations (such as a limited number or size of usable network buffers).
Implementations
impl<D: for<'a> Device<'a>> FaultInjector<D>
[src]
pub fn new(inner: D, seed: u32) -> FaultInjector<D>
[src]
Create a fault injector device, using the given random number generator seed.
pub fn into_inner(self) -> D
[src]
Return the underlying device, consuming the fault injector.
pub fn corrupt_chance(&self) -> u8
[src]
Return the probability of corrupting a packet, in percents.
pub fn drop_chance(&self) -> u8
[src]
Return the probability of dropping a packet, in percents.
pub fn max_packet_size(&self) -> usize
[src]
Return the maximum packet size, in octets.
pub fn max_tx_rate(&self) -> u64
[src]
Return the maximum packet transmission rate, in packets per second.
pub fn max_rx_rate(&self) -> u64
[src]
Return the maximum packet reception rate, in packets per second.
pub fn bucket_interval(&self) -> Duration
[src]
Return the interval for packet rate limiting, in milliseconds.
pub fn set_corrupt_chance(&mut self, pct: u8)
[src]
Set the probability of corrupting a packet, in percents.
Panics
This function panics if the probability is not between 0% and 100%.
pub fn set_drop_chance(&mut self, pct: u8)
[src]
Set the probability of dropping a packet, in percents.
Panics
This function panics if the probability is not between 0% and 100%.
pub fn set_max_packet_size(&mut self, size: usize)
[src]
Set the maximum packet size, in octets.
pub fn set_max_tx_rate(&mut self, rate: u64)
[src]
Set the maximum packet transmission rate, in packets per interval.
pub fn set_max_rx_rate(&mut self, rate: u64)
[src]
Set the maximum packet reception rate, in packets per interval.
pub fn set_bucket_interval(&mut self, interval: Duration)
[src]
Set the interval for packet rate limiting, in milliseconds.
Trait Implementations
impl<D: Debug + for<'a> Device<'a>> Debug for FaultInjector<D>
[src]
impl<'a, D> Device<'a> for FaultInjector<D> where
D: for<'b> Device<'b>,
[src]
D: for<'b> Device<'b>,
Auto Trait Implementations
impl<D> !RefUnwindSafe for FaultInjector<D>
[src]
impl<D> Send for FaultInjector<D> where
D: Send,
[src]
D: Send,
impl<D> !Sync for FaultInjector<D>
[src]
impl<D> Unpin for FaultInjector<D> where
D: Unpin,
[src]
D: Unpin,
impl<D> UnwindSafe for FaultInjector<D> where
D: UnwindSafe,
[src]
D: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,