[][src]Struct simrs::State

pub struct State { /* fields omitted */ }

State of a simulation holding all queues and arbitrary values in a store value.

Implementations

impl State[src]

#[must_use = "Discarding key results in leaking inserted value"]pub fn insert<V: 'static>(&mut self, value: V) -> Key<V>[src]

Inserts an arbitrary value to the value store. Learn more in the documentation for Key.

pub fn remove<V: 'static>(&mut self, key: Key<V>) -> Option<V>[src]

Removes a value of type V from the value store. Learn more in the documentation for Key.

#[must_use]pub fn get<V: 'static>(&self, key: Key<V>) -> Option<&V>[src]

Gets a immutable reference to a value of a type V from the value store. Learn more in the documentation for Key.

#[must_use]pub fn get_mut<V: 'static>(&mut self, key: Key<V>) -> Option<&mut V>[src]

Gets a mutable reference to a value of a type V from the value store. Learn more in the documentation for Key.

pub fn new_queue<V: 'static>(&mut self) -> QueueId<V>[src]

Creates a new unbounded queue, returning its ID.

pub fn new_bounded_queue<V: 'static>(&mut self, capacity: usize) -> QueueId<V>[src]

Creates a new bounded queue, returning its ID.

pub fn send<V: 'static>(
    &mut self,
    queue: QueueId<V>,
    value: V
) -> Result<(), ()>
[src]

Sends value to the queue.

Errors

It returns an error if the queue is full.

pub fn recv<V: 'static>(&mut self, queue: QueueId<V>) -> Option<V>[src]

Pops the first value from the queue. It returns None if the queue is empty.

pub fn len<V: 'static>(&mut self, queue: QueueId<V>) -> usize[src]

Checks the number of elements in the queue.

Trait Implementations

impl Default for State[src]

Auto Trait Implementations

impl !RefUnwindSafe for State

impl !Send for State

impl !Sync for State

impl Unpin for State

impl !UnwindSafe for State

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.