pub struct Observer;Expand description
The factory of observers (Observer).
Implementations§
Source§impl Observer
impl Observer
Sourcepub fn create<T: 'static>(on_next: impl Fn(T) + 'static) -> Rc<dyn IObserver<T>>
pub fn create<T: 'static>(on_next: impl Fn(T) + 'static) -> Rc<dyn IObserver<T>>
An observer of values; an error panics (Create(Action<T>)).
Sourcepub fn create_with_error<T: 'static>(
on_next: impl Fn(T) + 'static,
on_error: impl Fn(ObservableError) + 'static,
) -> Rc<dyn IObserver<T>>
pub fn create_with_error<T: 'static>( on_next: impl Fn(T) + 'static, on_error: impl Fn(ObservableError) + 'static, ) -> Rc<dyn IObserver<T>>
An observer of values and errors (Create(Action<T>, Action<Exception>)).
Sourcepub fn create_with_completed<T: 'static>(
on_next: impl Fn(T) + 'static,
on_completed: impl Fn() + 'static,
) -> Rc<dyn IObserver<T>>
pub fn create_with_completed<T: 'static>( on_next: impl Fn(T) + 'static, on_completed: impl Fn() + 'static, ) -> Rc<dyn IObserver<T>>
An observer of values and the end; an error panics (Create(Action<T>, Action)).
Sourcepub fn create_all<T: 'static>(
on_next: impl Fn(T) + 'static,
on_error: impl Fn(ObservableError) + 'static,
on_completed: impl Fn() + 'static,
) -> Rc<dyn IObserver<T>>
pub fn create_all<T: 'static>( on_next: impl Fn(T) + 'static, on_error: impl Fn(ObservableError) + 'static, on_completed: impl Fn() + 'static, ) -> Rc<dyn IObserver<T>>
An observer of all three notifications (Create(Action<T>, Action<Exception>, Action)).
Sourcepub fn to_observer<T: 'static>(
handler: impl Fn(Notification<T>) + 'static,
) -> Rc<dyn IObserver<T>>
pub fn to_observer<T: 'static>( handler: impl Fn(Notification<T>) + 'static, ) -> Rc<dyn IObserver<T>>
An observer that hands each notification, as a value, to handler (ToObserver(Action<Notification<T>>)).
Auto Trait Implementations§
impl Freeze for Observer
impl RefUnwindSafe for Observer
impl Send for Observer
impl Sync for Observer
impl Unpin for Observer
impl UnsafeUnpin for Observer
impl UnwindSafe for Observer
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