Skip to main content

SimRunner

Struct SimRunner 

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

Drives a collection of SimNodes connected via a SimBus.

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

Implementations§

Source§

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

Source

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

Source

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

Ticks the simulation by duration microseconds, routing all delivered messages to their destination nodes and collecting their responses back onto the bus.

Returns the number of messages delivered in this tick.

Source

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<const N: usize, const Q: usize> UnwindSafe for SimRunner<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.