Skip to main content

ObservableExt

Trait ObservableExt 

Source
pub trait ObservableExt<T: 'static> {
    // Required methods
    fn subscribe_fn(&self, on_next: impl Fn(T) + 'static) -> Rc<dyn IDisposable>;
    fn select<U: 'static>(
        &self,
        f: impl Fn(T) -> U + 'static,
    ) -> Rc<dyn IObservable<U>>;
    fn where_(&self, f: impl Fn(&T) -> bool + 'static) -> Rc<dyn IObservable<T>>;
    fn start_with(&self, value: T) -> Rc<dyn IObservable<T>>
       where T: Clone;
    fn combine_latest<TSecond: Clone + 'static, TResult: 'static>(
        &self,
        second: &Rc<dyn IObservable<TSecond>>,
        result_selector: impl Fn(T, TSecond) -> TResult + 'static,
    ) -> Rc<dyn IObservable<TResult>>
       where T: Clone;
    fn skip(&self, skip_count: i32) -> Rc<dyn IObservable<T>>;
    fn take(&self, take_count: i32) -> Rc<dyn IObservable<T>>;
}
Expand description

Operators available on every shared observable.

Required Methods§

Source

fn subscribe_fn(&self, on_next: impl Fn(T) + 'static) -> Rc<dyn IDisposable>

Subscribes with a closure invoked for every value.

Source

fn select<U: 'static>( &self, f: impl Fn(T) -> U + 'static, ) -> Rc<dyn IObservable<U>>

Projects each value.

Source

fn where_(&self, f: impl Fn(&T) -> bool + 'static) -> Rc<dyn IObservable<T>>

Filters values.

Source

fn start_with(&self, value: T) -> Rc<dyn IObservable<T>>
where T: Clone,

Produces value to each observer before the values of the source.

Source

fn combine_latest<TSecond: Clone + 'static, TResult: 'static>( &self, second: &Rc<dyn IObservable<TSecond>>, result_selector: impl Fn(T, TSecond) -> TResult + 'static, ) -> Rc<dyn IObservable<TResult>>
where T: Clone,

Combines the latest values of this observable and second with result_selector, once both have produced a value.

Source

fn skip(&self, skip_count: i32) -> Rc<dyn IObservable<T>>

Leaves out the first skip_count values.

Panics when skip_count is not bigger than zero.

Source

fn take(&self, take_count: i32) -> Rc<dyn IObservable<T>>

Produces the first take_count values and completes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: 'static> ObservableExt<T> for Rc<dyn IObservable<T>>

Source§

fn subscribe_fn(&self, on_next: impl Fn(T) + 'static) -> Rc<dyn IDisposable>

Source§

fn select<U: 'static>( &self, f: impl Fn(T) -> U + 'static, ) -> Rc<dyn IObservable<U>>

Source§

fn where_(&self, f: impl Fn(&T) -> bool + 'static) -> Rc<dyn IObservable<T>>

Source§

fn start_with(&self, value: T) -> Rc<dyn IObservable<T>>
where T: Clone,

Source§

fn combine_latest<TSecond: Clone + 'static, TResult: 'static>( &self, second: &Rc<dyn IObservable<TSecond>>, result_selector: impl Fn(T, TSecond) -> TResult + 'static, ) -> Rc<dyn IObservable<TResult>>
where T: Clone,

Source§

fn skip(&self, skip_count: i32) -> Rc<dyn IObservable<T>>

Source§

fn take(&self, take_count: i32) -> Rc<dyn IObservable<T>>

Implementors§