FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Observable

    struct · ferroui-base · v0.5.0

    struct Observable
    

    Factory functions for observables.

    View source

    Members

    create

    fn create<T: 'static>(subscribe: impl Fn(Rc<dyn IObserver<T>>) -> Rc<dyn IDisposable> + 'static) -> Rc<dyn IObservable<T>>
    

    Creates an observable from a subscribe function.

    Source

    return_

    fn return_<T: Clone + 'static>(value: T) -> Rc<dyn IObservable<T>>
    

    An observable that produces a single value and completes.

    Source

    single_value

    fn single_value<T: Clone + 'static>(value: T) -> Rc<dyn IObservable<T>>
    

    An observable that produces a single value and never completes.

    Source

    never

    fn never<T: 'static>() -> Rc<dyn IObservable<T>>
    

    An observable that never produces a value.

    Source

    empty

    fn empty<T: 'static>() -> Rc<dyn IObservable<T>>
    

    An observable that completes immediately.

    Source

    switch

    fn switch<TSource: 'static>(sources: Rc<dyn IObservable<Rc<dyn IObservable<TSource>>>>) -> Rc<dyn IObservable<TSource>>
    

    Forwards the values of the most recent of the observables that sources produces.

    Source

    combine_latest_all

    fn combine_latest_all<TInput: Clone + 'static>(inputs: impl IntoIterator<Item = Rc<dyn IObservable<TInput>>>) -> Rc<dyn IObservable<Vec<TInput>>>
    

    Combines the latest values of a sequence of observables: once every one of them has produced a value, each new value produces the list of the latest ones.

    Source

    from_event_pattern

    fn from_event_pattern<T: Clone + 'static>(add_handler: impl Fn(Rc<dyn Fn(&T) -> ()>) -> Rc<dyn IDisposable> + 'static) -> Rc<dyn IObservable<T>>
    

    An observable of the arguments of an event.

    add_handler adds the handler it is given to the event and returns the handle that removes it, as the events of this crate do (the original takes one function to add and one to remove a handler, for events with and without typed arguments).

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ErasedDestructor
    • IntoEither

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.