FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    HandlerList

    struct · ferroui-system · v0.5.0

    struct HandlerList<F: ?Sized>
    

    A list of event handlers that tolerates being modified while it is being invoked: invocation works on a snapshot, and the snapshot is only copied when the list actually changes.

    A list is one pointer wide. An object with a dozen events, almost all of which nobody subscribes to, pays that for each of them and nothing else (desktop-performance.md, section 9.40).

    The tokens of every list come from one counter of the process: within a list, and across lists, a later subscription has a greater token, and a token is never given out twice. The typed and the untyped form of one event, which run their handlers in subscription order as the single event of the original, need nothing more than that.

    View source

    Members

    new

    const fn new() -> Self
    

    Source

    is_empty

    fn is_empty(self: &Self) -> bool
    

    Source

    len

    fn len(self: &Self) -> usize
    

    Source

    add

    fn add(self: &Self, handler: Rc<F>) -> u64
    

    Adds a handler and returns a token that removes it again.

    Source

    remove

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

    Removes the handler registered under token.

    Source

    snapshot

    fn snapshot(self: &Self) -> HandlerSnapshot<F>
    

    Returns the current handlers; later modifications do not affect it.

    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.