Skip to main content

Notification

Enum Notification 

Source
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>

Source

pub fn kind(&self) -> NotificationKind

The kind of the notification (Kind).

Source

pub fn has_value(&self) -> bool

Whether the notification has a value (HasValue).

Source

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.

Source

pub fn exception(&self) -> Option<&ObservableError>

The error of an OnError notification (Exception).

Source

pub fn accept(self, observer: &dyn IObserver<T>)

Delivers the notification to an observer (Accept(IObserver<T>)).

Source

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>)).

Source

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>

Source

pub fn to_observable(&self) -> Rc<dyn IObservable<T>>

A sequence of the one notification, delivered on the immediate scheduler (ToObservable()).

Source

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>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Notification<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
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.

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: 'static> NotificationValue for Notification<T>

Source§

type Value = T

The type of the values of the notification.
Source§

fn into_notification(self) -> Notification<T>

The notification.
Source§

impl<T: PartialEq> PartialEq for Notification<T>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Notification<T>

§

impl<T> !Send for Notification<T>

§

impl<T> !Sync for Notification<T>

§

impl<T> !UnwindSafe for Notification<T>

§

impl<T> Freeze for Notification<T>
where T: Freeze,

§

impl<T> Unpin for Notification<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Notification<T>
where T: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.