Skip to main content

SharedHook

Struct SharedHook 

Source
pub struct SharedHook<E, M: Model<E>, H: Hook<E, M>> { /* private fields */ }
Expand description

A wrapper that allows a hook to be shared across multiple components via Arc.

Implementations§

Source§

impl<E, M: Model<E>, H: Hook<E, M>> SharedHook<E, M, H>

Source

pub fn new(hook: H) -> Self

Creates a new SharedHook wrapping the provided hook.

Source

pub fn get_ref(&self) -> &H

Returns a reference to the underlying hook.

Trait Implementations§

Source§

impl<E, M: Model<E>, H: Hook<E, M>> Clone for SharedHook<E, M, H>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E, M: Model<E>, H> Hook<E, M> for SharedHook<E, M, H>
where H: Hook<E, M>,

Source§

fn before_simulation(&self, model: &M)

Invoked immediately before the simulation starts.
Source§

fn after_simulation(&self, model: &M, end_tick: SimTime)

Invoked immediately after the simulation finishes.
Source§

fn before_tick( &self, model: &M, current_tick: SimTime, skipped_duration: Duration, )

Invoked at the beginning of a tick process. Read more
Source§

fn after_tick( &self, model: &M, current_tick: SimTime, last_micro_step: MicroStep, )

Invoked immediately after a tick process has completed.
Source§

fn before_micro_step( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, )

Invoked at the beginning of a micro-step.
Source§

fn after_micro_step( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, )

Invoked at the end of a micro-step.
Source§

fn on_discard_remain_micro_step( &self, model: &M, current_tick: SimTime, first_discarded_micro_step: MicroStep, discarded_sources: &[SourceReadyEntry], discarded_events: &[Event<E>], )

Invoked when remaining tasks (events or sources) are discarded due to execution limits.
Source§

fn before_register_source(&self, model: &M, name: &str)

Invoked when a source registration begins.
Source§

fn after_register_source(&self, model: &M, name: &str)

Invoked when a source registration completes.
Source§

fn before_source_phase( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, )

Invoked at the beginning of the source processing phase.
Source§

fn before_source( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, source_view: &SourceView, )

Invoked immediately before an individual source fires.
Source§

fn after_source( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, source_view: &SourceView, computed_next_fire: Option<SimTime>, )

Invoked immediately after an individual source fires.
Source§

fn cancel_source( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, scheduled_at: SimTime, source_view: &SourceView, )

Invoked when a scheduled source is canceled.
Source§

fn discard_source( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, source_view: &SourceView, )

Invoked when a source is explicitly discarded.
Source§

fn after_source_phase( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, )

Invoked at the end of the source processing phase.
Source§

fn before_event_phase( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, )

Invoked at the beginning of the event processing phase.
Source§

fn before_event( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, event: &Event<E>, )

Invoked immediately before an event is processed.
Source§

fn after_event( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, event: &Event<E>, )

Invoked immediately after an event is processed.
Source§

fn cancel_event( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, scheduled_at: SimTime, event: &Event<E>, )

Invoked when a scheduled event is canceled.
Source§

fn discard_event( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, event: &Event<E>, )

Invoked when an event is discarded.
Source§

fn after_event_phase( &self, model: &M, current_tick: SimTime, current_micro_step: MicroStep, )

Invoked at the end of the event processing phase.

Auto Trait Implementations§

§

impl<E, M, H> Freeze for SharedHook<E, M, H>

§

impl<E, M, H> RefUnwindSafe for SharedHook<E, M, H>

§

impl<E, M, H> Send for SharedHook<E, M, H>
where H: Sync + Send, E: Send, M: Send,

§

impl<E, M, H> Sync for SharedHook<E, M, H>
where H: Sync + Send, E: Sync, M: Sync,

§

impl<E, M, H> Unpin for SharedHook<E, M, H>
where E: Unpin, M: Unpin,

§

impl<E, M, H> UnsafeUnpin for SharedHook<E, M, H>

§

impl<E, M, H> UnwindSafe for SharedHook<E, M, H>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.