FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    LightweightObservableBase

    struct · ferroui-base · v0.5.0

    struct LightweightObservableBase<T>
    

    The state of a lightweight observable: its observers, notified in subscription order, and the error it failed with. Once it completes or fails, the list is gone and later subscribers are told so at once.

    View source

    Members

    new

    fn new() -> Self
    

    Source

    has_observers

    fn has_observers(self: &Self) -> bool
    

    Whether any observer is subscribed.

    Source

    subscribe

    fn subscribe<O: LightweightObservable<T>>(owner: &Rc<O>, observer: Rc<dyn IObserver<T>>) -> Rc<dyn IDisposable>
    where T: 'static
    

    Subscribes observer to owner. The first subscription initializes the owner; disposing the returned handle removes the observer.

    Source

    publish_next

    fn publish_next(self: &Self, value: T)
    where T: Clone
    

    Notifies every observer of a value.

    Source

    publish_completed

    fn publish_completed<O: LightweightObservable<T>>(owner: &O)
    

    Completes the observable: notifies every observer and deinitializes the owner.

    Source

    publish_error

    fn publish_error<O: LightweightObservable<T>>(owner: &O, error: ObservableError)
    

    Fails the observable: notifies every observer and deinitializes the owner.

    Source

    Trait implementations

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

    Availability

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