Event
struct · ferroui-system · v0.5.0
struct Event<A: ?Sized>
A multicast event of a model object: the equivalent of a managed event
member on a type that is not part of the class hierarchy.
Handlers are identified by the token returned from add.
Raising works on a snapshot, so handlers may add or remove handlers.
Members
new
const fn new() -> Self
snapshot
fn snapshot(self: &Self) -> HandlerSnapshot<dyn Fn(&A) -> ()>
The current handlers with their tokens; later changes do not affect it.
add
fn add(self: &Self, handler: Rc<dyn Fn(&A) -> ()>) -> u64
Adds a handler; returns the token that removes it.
remove
fn remove(self: &Self, token: u64) -> bool
Removes a handler. Returns false if the token is unknown.
has_handlers
fn has_handlers(self: &Self) -> bool
Whether any handler is subscribed.
handler_count
fn handler_count(self: &Self) -> usize
The number of subscribed handlers.
raise
fn raise(self: &Self, args: &A)
Invokes the handlers.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyDefault
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.