pub struct ObservableBase<T> { /* private fields */ }Expand description
An observable whose subscription is the user’s ObservableCore (ObservableBase<T>).
The observer the core receives ignores everything after a terminal notification, and a
terminal notification, or a panic while the observer handles a value, disposes the
subscription (AutoDetachObserver<T>). When no work of the current-thread scheduler is
running, the subscription runs through its trampoline, so that work it schedules there runs
after the subscription has been set up.
Implementations§
Source§impl<T: 'static> ObservableBase<T>
impl<T: 'static> ObservableBase<T>
Sourcepub fn new(core: impl ObservableCore<T> + 'static) -> Self
pub fn new(core: impl ObservableCore<T> + 'static) -> Self
An observable whose subscription is core (a subclass of ObservableBase<T> upstream).
Sourcepub fn from_fn(
subscribe_core: impl Fn(Rc<dyn IObserver<T>>) -> Rc<dyn IDisposable> + 'static,
) -> Self
pub fn from_fn( subscribe_core: impl Fn(Rc<dyn IObserver<T>>) -> Rc<dyn IDisposable> + 'static, ) -> Self
An observable whose subscription is the function subscribe_core.
Sourcepub fn try_from_fn(
subscribe_core: impl Fn(Rc<dyn IObserver<T>>) -> Result<Rc<dyn IDisposable>, ObservableError> + 'static,
) -> Self
pub fn try_from_fn( subscribe_core: impl Fn(Rc<dyn IObserver<T>>) -> Result<Rc<dyn IDisposable>, ObservableError> + 'static, ) -> Self
An observable whose subscription is the function subscribe_core, which may fail: an Err
is delivered to the observer as its error (a SubscribeCore that throws upstream).
Trait Implementations§
Source§impl<T: 'static> IObservable<T> for ObservableBase<T>
impl<T: 'static> IObservable<T> for ObservableBase<T>
Source§fn subscribe(&self, observer: Rc<dyn IObserver<T>>) -> Rc<dyn IDisposable>
fn subscribe(&self, observer: Rc<dyn IObserver<T>>) -> Rc<dyn IDisposable>
Subscribes through the core (Subscribe): the observer is wrapped in an auto-detaching
observer, which the core receives; an error of the core is delivered to that observer
(AutoDetachObserver.Fail), and panics, where upstream rethrows it, when the observer has
stopped already.