[][src]Struct simrs::Simulation

pub struct Simulation {
    pub state: State,
    pub scheduler: Scheduler,
    pub components: Components,
}

Simulation struct that puts different parts of the simulation together.

See the crate-level documentation for more information.

Fields

state: State

Simulation state.

scheduler: Scheduler

Event scheduler.

components: Components

Component container.

Implementations

impl Simulation[src]

pub fn step(&mut self) -> bool[src]

Performs one step of the simulation. Returns true if there was in fact an event available to process, and false instead, which signifies that the simulation ended.

pub fn run(&mut self)[src]

Runs the entire simulation from start to end. This function might not terminate if the end condition is not satisfied.

#[must_use]pub fn add_component<E: Debug + 'static, C: Component<Event = E> + 'static>(
    &mut self,
    component: C
) -> ComponentId<E>
[src]

Adds a new component.

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

Adds a new unbounded queue.

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

Adds a new bounded queue.

pub fn schedule<E: Debug + 'static>(
    &mut self,
    time: Duration,
    component: ComponentId<E>,
    event: E
)
[src]

Schedules a new event to be executed at time time in component component.

Trait Implementations

impl Default for Simulation[src]

Auto Trait Implementations

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.