pub struct EventContributions { /* private fields */ }Expand description
The per-plugin accumulator the events::Host impl records into during
register-events (lib.rs). Held in PluginState; drained by the host
after the registration export returns (PH7.8c). record is the sync
host-func body (it only pushes — it cannot trap), factored here (the
GrammarContributions precedent)
so recording is unit-testable without a PluginState / guest.
Implementations§
Source§impl EventContributions
impl EventContributions
Sourcepub fn record(&mut self, filter: WitEventFilter, handler: u32)
pub fn record(&mut self, filter: WitEventFilter, handler: u32)
Record a subscription (the events.subscribe host-func body).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True when the plugin subscribed to nothing (the degenerate case — a
non-observing plugin, or one whose register-events is empty).
Sourcepub fn take(&mut self) -> Vec<RecordedSubscription>
pub fn take(&mut self) -> Vec<RecordedSubscription>
Drain the recorded subscriptions, leaving the accumulator empty. Called by
the host after register-events returns (PH7.8c) to wire the bus.
Trait Implementations§
Source§impl Default for EventContributions
impl Default for EventContributions
Source§fn default() -> EventContributions
fn default() -> EventContributions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EventContributions
impl RefUnwindSafe for EventContributions
impl Send for EventContributions
impl Sync for EventContributions
impl Unpin for EventContributions
impl UnsafeUnpin for EventContributions
impl UnwindSafe for EventContributions
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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