pub struct EventContext<'a, S, A, Props, R>where
A: Agent,{ /* private fields */ }Expand description
Context passed to event-queue action callbacks during EventQueueModel::step_event.
Provides safe mutable access to space, properties, RNG, and the event queue without aliasing the currently-borrowed agent.
Implementations§
Source§impl<'a, S, A, Props, R> EventContext<'a, S, A, Props, R>where
A: Agent,
impl<'a, S, A, Props, R> EventContext<'a, S, A, Props, R>where
A: Agent,
Sourcepub fn properties(&self) -> &Props
pub fn properties(&self) -> &Props
Immutable reference to user-defined model properties.
Sourcepub fn properties_mut(&mut self) -> &mut Props
pub fn properties_mut(&mut self) -> &mut Props
Mutable reference to user-defined model properties.
Sourcepub fn add_event(&mut self, agent_id: AgentId, event_idx: usize, dt: f64)
pub fn add_event(&mut self, agent_id: AgentId, event_idx: usize, dt: f64)
Schedule a new event relative to the current time.
§Panics
Panics if dt is negative, NaN, or infinite.
Sourcepub fn defer_remove_agent(&mut self, id: AgentId)
pub fn defer_remove_agent(&mut self, id: AgentId)
Schedule an agent for removal after the current event completes.
Sourcepub fn defer_insert_agent(&mut self, agent: A)
pub fn defer_insert_agent(&mut self, agent: A)
Schedule an agent for insertion after the current event completes.
Auto Trait Implementations§
impl<'a, S, A, Props, R> Freeze for EventContext<'a, S, A, Props, R>
impl<'a, S, A, Props, R> RefUnwindSafe for EventContext<'a, S, A, Props, R>
impl<'a, S, A, Props, R> Send for EventContext<'a, S, A, Props, R>
impl<'a, S, A, Props, R> Sync for EventContext<'a, S, A, Props, R>
impl<'a, S, A, Props, R> Unpin for EventContext<'a, S, A, Props, R>
impl<'a, S, A, Props, R> UnsafeUnpin for EventContext<'a, S, A, Props, R>
impl<'a, S, A, Props, R> !UnwindSafe for EventContext<'a, S, A, Props, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more