Skip to main content

TcpSimRunner

Struct TcpSimRunner 

Source
pub struct TcpSimRunner<const MAX_DATA: usize, const MAX_QUEUED: usize, const TCP_MAX_EVENTS: usize, const MAX_OUTBOX: 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 MAX_DATA: usize, const MAX_QUEUED: usize, const TCP_MAX_EVENTS: usize, const MAX_OUTBOX: usize> TcpSimRunner<MAX_DATA, MAX_QUEUED, TCP_MAX_EVENTS, MAX_OUTBOX>

Source

pub fn new(bus: TcpSimBus<MAX_DATA, MAX_QUEUED, TCP_MAX_EVENTS>) -> Self

Source

pub fn bus(&mut self) -> &mut TcpSimBus<MAX_DATA, MAX_QUEUED, TCP_MAX_EVENTS>

Source

pub fn now(&self) -> Instant

Source

pub fn tick( &mut self, nodes: &mut [&mut dyn SimNodeErased<MAX_DATA, MAX_OUTBOX>], 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 MAX_DATA: usize, const MAX_QUEUED: usize, const TCP_MAX_EVENTS: usize, const MAX_OUTBOX: usize> Freeze for TcpSimRunner<MAX_DATA, MAX_QUEUED, TCP_MAX_EVENTS, MAX_OUTBOX>

§

impl<const MAX_DATA: usize, const MAX_QUEUED: usize, const TCP_MAX_EVENTS: usize, const MAX_OUTBOX: usize> RefUnwindSafe for TcpSimRunner<MAX_DATA, MAX_QUEUED, TCP_MAX_EVENTS, MAX_OUTBOX>

§

impl<const MAX_DATA: usize, const MAX_QUEUED: usize, const TCP_MAX_EVENTS: usize, const MAX_OUTBOX: usize> Send for TcpSimRunner<MAX_DATA, MAX_QUEUED, TCP_MAX_EVENTS, MAX_OUTBOX>

§

impl<const MAX_DATA: usize, const MAX_QUEUED: usize, const TCP_MAX_EVENTS: usize, const MAX_OUTBOX: usize> Sync for TcpSimRunner<MAX_DATA, MAX_QUEUED, TCP_MAX_EVENTS, MAX_OUTBOX>

§

impl<const MAX_DATA: usize, const MAX_QUEUED: usize, const TCP_MAX_EVENTS: usize, const MAX_OUTBOX: usize> Unpin for TcpSimRunner<MAX_DATA, MAX_QUEUED, TCP_MAX_EVENTS, MAX_OUTBOX>

§

impl<const MAX_DATA: usize, const MAX_QUEUED: usize, const TCP_MAX_EVENTS: usize, const MAX_OUTBOX: usize> UnsafeUnpin for TcpSimRunner<MAX_DATA, MAX_QUEUED, TCP_MAX_EVENTS, MAX_OUTBOX>

§

impl<const MAX_DATA: usize, const MAX_QUEUED: usize, const TCP_MAX_EVENTS: usize, const MAX_OUTBOX: usize> UnwindSafe for TcpSimRunner<MAX_DATA, MAX_QUEUED, TCP_MAX_EVENTS, MAX_OUTBOX>

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.