pub struct LightweightObservableBase<T> { /* private fields */ }Expand description
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.
Implementations§
Source§impl<T> LightweightObservableBase<T>
impl<T> LightweightObservableBase<T>
pub fn new() -> Self
Sourcepub fn has_observers(&self) -> bool
pub fn has_observers(&self) -> bool
Whether any observer is subscribed.
Sourcepub fn subscribe<O: LightweightObservable<T>>(
owner: &Rc<O>,
observer: Rc<dyn IObserver<T>>,
) -> Rc<dyn IDisposable>where
T: 'static,
pub 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.
Sourcepub fn publish_next(&self, value: T)where
T: Clone,
pub fn publish_next(&self, value: T)where
T: Clone,
Notifies every observer of a value.
Sourcepub fn publish_completed<O: LightweightObservable<T>>(owner: &O)
pub fn publish_completed<O: LightweightObservable<T>>(owner: &O)
Completes the observable: notifies every observer and deinitializes the owner.
Sourcepub fn publish_error<O: LightweightObservable<T>>(
owner: &O,
error: ObservableError,
)
pub fn publish_error<O: LightweightObservable<T>>( owner: &O, error: ObservableError, )
Fails the observable: notifies every observer and deinitializes the owner.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for LightweightObservableBase<T>
impl<T> !RefUnwindSafe for LightweightObservableBase<T>
impl<T> !Send for LightweightObservableBase<T>
impl<T> !Sync for LightweightObservableBase<T>
impl<T> !UnwindSafe for LightweightObservableBase<T>
impl<T> Unpin for LightweightObservableBase<T>
impl<T> UnsafeUnpin for LightweightObservableBase<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more