[−][src]Struct simrs::Simulation
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<F: Fn(&Simulation)>(&mut self, step_function: F)
[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]
&mut self,
component: C
) -> ComponentId<E>
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]
&mut self,
time: Duration,
component: ComponentId<E>,
event: E
)
Schedules a new event to be executed at time time
in component component
.
Trait Implementations
impl Default for Simulation
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Simulation
impl !Send for Simulation
impl !Sync for Simulation
impl Unpin for Simulation
impl !UnwindSafe for Simulation
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,