pub struct SimulatedNetwork { /* private fields */ }Expand description
A simulated network that models latency, jitter, loss, and reordering.
Implementations§
Source§impl SimulatedNetwork
impl SimulatedNetwork
Sourcepub fn new(config: NetworkConfig) -> Self
pub fn new(config: NetworkConfig) -> Self
Creates a new SimulatedNetwork with the given configuration.
Sourcepub fn send(
&mut self,
payload: Vec<u8>,
src: SocketAddr,
dst: SocketAddr,
now: Instant,
)
pub fn send( &mut self, payload: Vec<u8>, src: SocketAddr, dst: SocketAddr, now: Instant, )
Sends a payload through the simulated network.
Sourcepub fn receive(&mut self, now: Instant) -> Option<QueuedDatagram>
pub fn receive(&mut self, now: Instant) -> Option<QueuedDatagram>
Receives a datagram from the network if it’s ready.
Auto Trait Implementations§
impl Freeze for SimulatedNetwork
impl RefUnwindSafe for SimulatedNetwork
impl Send for SimulatedNetwork
impl Sync for SimulatedNetwork
impl Unpin for SimulatedNetwork
impl UnsafeUnpin for SimulatedNetwork
impl UnwindSafe for SimulatedNetwork
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