Skip to main content

CanSimRunner

Struct CanSimRunner 

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

Drivers SimNodeErased slices over a CanSimBus.

N - max CAN frame payload bytes (8 classic, 64 FD) Q - max frames in-flight on the bus

Implementations§

Source§

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

Source

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

Source

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

Source

pub fn now(&self) -> Instant

Source

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

Ticks the simulation by duration.

Order of operations per tick: 1. Advance bus clock, apply CAN fault injection, deliver due frames (no frames delivered if bus is in bus-off state) 2. Deliver CAN events to nodes implementing CanEventHandler 3. Tick all nodes 4. Drain node outboxes onto the bus

Returns the number of frames delivered.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

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