FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    new

    const fn new() -> Self
    

    Source

    snapshot

    fn snapshot(self: &Self) -> HandlerSnapshot<dyn Fn(&A) -> ()>
    

    The current handlers with their tokens; later changes do not affect it.

    Source

    add

    fn add(self: &Self, handler: Rc<dyn Fn(&A) -> ()>) -> u64
    

    Adds a handler; returns the token that removes it.

    Source

    remove

    fn remove(self: &Self, token: u64) -> bool
    

    Removes a handler. Returns false if the token is unknown.

    Source

    has_handlers

    fn has_handlers(self: &Self) -> bool
    

    Whether any handler is subscribed.

    Source

    handler_count

    fn handler_count(self: &Self) -> usize
    

    The number of subscribed handlers.

    Source

    raise

    fn raise(self: &Self, args: &A)
    

    Invokes the handlers.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • Default

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.