pub struct AnonymousObserver<T> { /* private fields */ }Expand description
An observer built from closures.
An observer without a closure for errors rethrows an error it is given (it panics with the message of the error); one without a closure for completion ignores it.
Implementations§
Source§impl<T> AnonymousObserver<T>
impl<T> AnonymousObserver<T>
pub fn new(on_next: impl Fn(T) + 'static) -> Self
pub fn new_with_error( on_next: impl Fn(T) + 'static, on_error: impl Fn(ObservableError) + 'static, ) -> Self
pub fn new_with_completed( on_next: impl Fn(T) + 'static, on_completed: impl Fn() + 'static, ) -> Self
pub fn new_with_error_and_completed( on_next: impl Fn(T) + 'static, on_error: impl Fn(ObservableError) + 'static, on_completed: impl Fn() + 'static, ) -> Self
pub fn with_error(self, on_error: impl Fn(ObservableError) + 'static) -> Self
pub fn with_completed(self, on_completed: impl Fn() + 'static) -> Self
Trait Implementations§
Source§impl<T> IObserver<T> for AnonymousObserver<T>
impl<T> IObserver<T> for AnonymousObserver<T>
fn on_next(&self, value: T)
fn on_error(&self, error: ObservableError)
fn on_completed(&self)
Auto Trait Implementations§
impl<T> !RefUnwindSafe for AnonymousObserver<T>
impl<T> !Send for AnonymousObserver<T>
impl<T> !Sync for AnonymousObserver<T>
impl<T> !UnwindSafe for AnonymousObserver<T>
impl<T> Freeze for AnonymousObserver<T>
impl<T> Unpin for AnonymousObserver<T>
impl<T> UnsafeUnpin for AnonymousObserver<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