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.
Members
new
fn new() -> Self
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.
dispose
fn dispose(self: &Self, unsubscribed: impl FnOnce() -> ())
Ends the subscription: runs unsubscribed and forgets the observer.
has_observer
fn has_observer(self: &Self) -> bool
Whether an observer is currently subscribed.
publish_next
fn publish_next(self: &Self, value: T)
publish_completed
fn publish_completed(self: &Self, unsubscribed: impl FnOnce() -> ())
publish_error
fn publish_error(self: &Self, error: ObservableError, unsubscribed: impl FnOnce() -> ())
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEitherDefault
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.