pub enum Notification<T> {
OnNext(T),
OnError(ObservableError),
OnCompleted,
}Expand description
A notification of an observable sequence as a value (Notification<T>).
Two notifications are equal when they are of the same kind and their values are equal; errors compare by identity, as exceptions do upstream.
Variants§
OnNext(T)
A value (Notification.CreateOnNext).
OnError(ObservableError)
An error (Notification.CreateOnError).
OnCompleted
The end of the sequence (Notification.CreateOnCompleted).
Implementations§
Source§impl<T> Notification<T>
impl<T> Notification<T>
Sourcepub fn kind(&self) -> NotificationKind
pub fn kind(&self) -> NotificationKind
The kind of the notification (Kind).
Sourcepub fn value(&self) -> Option<&T>
pub fn value(&self) -> Option<&T>
The value of an OnNext notification (Value); None for the others, where upstream throws
the error of an OnError and InvalidOperationException for OnCompleted.
Sourcepub fn exception(&self) -> Option<&ObservableError>
pub fn exception(&self) -> Option<&ObservableError>
The error of an OnError notification (Exception).
Sourcepub fn accept(self, observer: &dyn IObserver<T>)
pub fn accept(self, observer: &dyn IObserver<T>)
Delivers the notification to an observer (Accept(IObserver<T>)).
Sourcepub fn accept_observer_with_result<R>(
self,
observer: &dyn IObserverWithResult<T, R>,
) -> R
pub fn accept_observer_with_result<R>( self, observer: &dyn IObserverWithResult<T, R>, ) -> R
Delivers the notification to an observer whose handlers return a result, and returns it
(Accept<TResult>(IObserver<T, TResult>)).
Sourcepub fn accept_fns<R>(
self,
on_next: impl FnOnce(T) -> R,
on_error: impl FnOnce(ObservableError) -> R,
on_completed: impl FnOnce() -> R,
) -> R
pub fn accept_fns<R>( self, on_next: impl FnOnce(T) -> R, on_error: impl FnOnce(ObservableError) -> R, on_completed: impl FnOnce() -> R, ) -> R
Calls the function for the kind of the notification (Accept(Func<T, TResult>, ...)).
Source§impl<T: Clone + 'static> Notification<T>
impl<T: Clone + 'static> Notification<T>
Sourcepub fn to_observable(&self) -> Rc<dyn IObservable<T>>
pub fn to_observable(&self) -> Rc<dyn IObservable<T>>
A sequence of the one notification, delivered on the immediate scheduler (ToObservable()).
Sourcepub fn to_observable_on(
&self,
scheduler: Rc<dyn IScheduler>,
) -> Rc<dyn IObservable<T>>
pub fn to_observable_on( &self, scheduler: Rc<dyn IScheduler>, ) -> Rc<dyn IObservable<T>>
A sequence of the one notification, delivered on scheduler: a value is followed by the end
of the sequence (ToObservable(IScheduler)).
Trait Implementations§
Source§impl<T: Clone> Clone for Notification<T>
impl<T: Clone> Clone for Notification<T>
Source§impl<T: Debug> Debug for Notification<T>
impl<T: Debug> Debug for Notification<T>
Source§impl<T: Hash> Hash for Notification<T>
The hash of a notification (GetHashCode), consistent with its equality: a value hashes as the
value; an error by its identity (the address of the error, which is what its equality
compares); the end of the sequence as the name of the type of the values combined with a
constant, as upstream’s typeof(T).FullName.GetHashCode() ^ 8510.
impl<T: Hash> Hash for Notification<T>
The hash of a notification (GetHashCode), consistent with its equality: a value hashes as the
value; an error by its identity (the address of the error, which is what its equality
compares); the end of the sequence as the name of the type of the values combined with a
constant, as upstream’s typeof(T).FullName.GetHashCode() ^ 8510.