Trait caminos_lib::event::Eventful [−][src]
pub trait Eventful {
fn process(&mut self, simulation: &Simulation<'_>) -> Vec<EventGeneration>;
fn pending_events(&self) -> usize;
fn add_pending_event(&mut self);
fn clear_pending_events(&mut self);
fn as_eventful(&self) -> Weak<RefCell<dyn Eventful>>;
}
Expand description
A trait to be implemented for generic objects to be inserted in the event queue.
Required methods
fn process(&mut self, simulation: &Simulation<'_>) -> Vec<EventGeneration>
fn process(&mut self, simulation: &Simulation<'_>) -> Vec<EventGeneration>
Method to ve called to process the events.
fn pending_events(&self) -> usize
fn pending_events(&self) -> usize
Number of pending events.
fn add_pending_event(&mut self)
fn add_pending_event(&mut self)
Mark the eventful as having another pending event. It should also be added to some queue.
fn clear_pending_events(&mut self)
fn clear_pending_events(&mut self)
Mark the eventful as having no pending events. Perhaps it is not necessary, since it is being done by the process
method.
fn as_eventful(&self) -> Weak<RefCell<dyn Eventful>>
fn as_eventful(&self) -> Weak<RefCell<dyn Eventful>>
Extract the eventful from the implementing class. Required since as Rc<RefCell<Eventful>>
does not work.