Skip to main content

TcpSimRunner

Struct TcpSimRunner 

Source
pub struct TcpSimRunner<const N: usize, const Q: usize> { /* private fields */ }
Expand description

Drives SimNodeErased slices over a TcpSimBus.

N - max message payload bytes Q - max messages in-flight on the bus

Implementations§

Source§

impl<const N: usize, const Q: usize> TcpSimRunner<N, Q>

Source

pub fn new(bus: TcpSimBus<N, Q>) -> Self

Source

pub fn bus(&mut self) -> &mut TcpSimBus<N, Q>

Source

pub fn now(&self) -> Instant

Source

pub fn tick( &mut self, nodes: &mut [&mut dyn SimNodeErased<N, Q>], tcp_event_nodes: &mut [&mut dyn TcpEventHandler], duration: Duration, ) -> usize

Ticks the simulation by duration.

Order of operations per tick: 1. Advance bus clock, apply TCP fault injection, deliver due messages 2. Deliver TCP connection events to nodes implementing TcpEventHandler 3. Tick all nodes for time-based transitions 4. Drain node outboxes and enqueue onto the bus

Returns the number of messages delivered.

Auto Trait Implementations§

§

impl<const N: usize, const Q: usize> Freeze for TcpSimRunner<N, Q>

§

impl<const N: usize, const Q: usize> RefUnwindSafe for TcpSimRunner<N, Q>

§

impl<const N: usize, const Q: usize> Send for TcpSimRunner<N, Q>

§

impl<const N: usize, const Q: usize> Sync for TcpSimRunner<N, Q>

§

impl<const N: usize, const Q: usize> Unpin for TcpSimRunner<N, Q>

§

impl<const N: usize, const Q: usize> UnsafeUnpin for TcpSimRunner<N, Q>

§

impl<const N: usize, const Q: usize> UnwindSafe for TcpSimRunner<N, Q>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.