FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    EventObservable

    struct · ferroui-reactiveui · v0.5.0

    struct EventObservable<T: 'static>
    

    The value of a property on subscription, then again each time its change event is raised (EventObservable<T>).

    The value comes from the getter, which is read on subscription and on every raise, so the arguments of the event are ignored. The value read on subscription is always delivered; with distinct_until_changed, a later value equal to the last one delivered is dropped. A getter that panics on subscription detaches the handler before the panic propagates; one that panics while the event is raised propagates to whoever raised it. The sequence never completes.

    View source

    Members

    new

    fn new(add_handler: impl Fn(Rc<dyn Fn() -> ()>) -> () + 'static, remove_handler: impl Fn(Rc<dyn Fn() -> ()>) -> () + 'static, getter: impl Fn() -> T + 'static, distinct_until_changed: bool) -> Self
    

    The values getter reads, on subscription and each time the event that add_handler subscribes a handler to (and remove_handler unsubscribes it from) is raised (EventObservable(Action<EventHandler>, Action<EventHandler>, Func<T>, bool)). A handler is an Rc<dyn Fn()> (EventHandler), compared by identity: the handler given to remove_handler is the one given to add_handler.

    Source

    Trait implementations

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

    Availability

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