Struct smoltcp::phy::FaultInjector

source ·
pub struct FaultInjector<D: for<'a> Device<'a>> { /* private fields */ }
Expand description

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§

Create a fault injector device, using the given random number generator seed.

Return the underlying device, consuming the fault injector.

Return the probability of corrupting a packet, in percents.

Return the probability of dropping a packet, in percents.

Return the maximum packet size, in octets.

Return the maximum packet transmission rate, in packets per second.

Return the maximum packet reception rate, in packets per second.

Return the interval for packet rate limiting, in milliseconds.

Set the probability of corrupting a packet, in percents.

Panics

This function panics if the probability is not between 0% and 100%.

Set the probability of dropping a packet, in percents.

Panics

This function panics if the probability is not between 0% and 100%.

Set the maximum packet size, in octets.

Set the maximum packet transmission rate, in packets per interval.

Set the maximum packet reception rate, in packets per interval.

Set the interval for packet rate limiting, in milliseconds.

Trait Implementations§

Formats the value using the given formatter. Read more
Get a description of device capabilities.
Construct a token pair consisting of one receive token and one transmit token. Read more
Construct a transmit token.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.