FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    SingleSubscriberObservableBase

    struct · ferroui-base · v0.5.0

    struct SingleSubscriberObservableBase<T>
    

    The base of observables that accept exactly one subscriber and hand themselves out as the subscription.

    The observable embeds this state, implements IObservable by calling subscribe and IDisposable by calling dispose, passing what has to happen when the subscription starts and ends.

    View source

    Members

    new

    fn new() -> Self
    

    Source

    subscribe

    fn subscribe(self: &Self, observer: Rc<dyn IObserver<T>>, subscribed: impl FnOnce() -> ())
    

    Registers the observer. subscribed runs once it is registered, unless the observable has already failed or completed, in which case the observer is told so instead.

    Panics when there already is a subscriber.

    Source

    dispose

    fn dispose(self: &Self, unsubscribed: impl FnOnce() -> ())
    

    Ends the subscription: runs unsubscribed and forgets the observer.

    Source

    has_observer

    fn has_observer(self: &Self) -> bool
    

    Whether an observer is currently subscribed.

    Source

    publish_next

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

    Source

    publish_completed

    fn publish_completed(self: &Self, unsubscribed: impl FnOnce() -> ())
    

    Source

    publish_error

    fn publish_error(self: &Self, error: ObservableError, unsubscribed: impl FnOnce() -> ())
    

    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.