FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    OptionObservableExtensions

    trait · ferroui-dynamic-data · v0.5.0

    trait OptionObservableExtensions<T: Clone + 'static>
    

    The operators of sequences of options (OptionObservableExtensions), implemented for Rc<dyn IObservable<Option<T>>>.

    It also carries EditDiff of a sequence of options (ObservableCacheEx.EditDiff( IObservable<Optional<TObject>>, ..)), as edit_diff_optional.

    View source

    Members

    options

    fn options(self: &Self) -> Rc<dyn IObservable<Option<T>>>
    

    The sequence as the handle the operators take.

    Source

    convert

    fn convert<U: 'static>(self: &Self, converter: impl Fn(T) -> U + 'static) -> Rc<dyn IObservable<Option<U>>>
    

    Each value converted by converter; none stays none (Convert(Func<TSource, TDestination>)).

    Source

    convert_optional

    fn convert_optional<U: 'static>(self: &Self, converter: impl Fn(T) -> Option<U> + 'static) -> Rc<dyn IObservable<Option<U>>>
    

    The option that converter makes of each value; none stays none (Convert(Func<TSource, Optional<TDestination>>)).

    Source

    convert_or

    fn convert_or<U: 'static>(self: &Self, converter: impl Fn(T) -> U + 'static, fallback_converter: impl Fn() -> U + 'static) -> Rc<dyn IObservable<U>>
    

    Each value converted by converter, and what fallback_converter makes for none (ConvertOr).

    Source

    or_else

    fn or_else(self: &Self, fallback_operation: impl Fn() -> Option<T> + 'static) -> Rc<dyn IObservable<Option<T>>>
    

    The options, with what fallback_operation makes in place of none (OrElse).

    Source

    on_has_value

    fn on_has_value(self: &Self, action: impl Fn(&T) -> () + 'static) -> Rc<dyn IObservable<Option<T>>>
    

    Runs action with each value (OnHasValue(Action<T>)).

    Source

    on_has_value_with_else

    fn on_has_value_with_else(self: &Self, action: impl Fn(&T) -> () + 'static, else_action: impl Fn() -> () + 'static) -> Rc<dyn IObservable<Option<T>>>
    

    Runs action with each value, and else_action for each none (OnHasValue(Action<T>, Action)).

    Source

    on_has_no_value

    fn on_has_no_value(self: &Self, action: impl Fn() -> () + 'static) -> Rc<dyn IObservable<Option<T>>>
    

    Runs action for each none (OnHasNoValue(Action)).

    Source

    on_has_no_value_with_else

    fn on_has_no_value_with_else(self: &Self, action: impl Fn() -> () + 'static, else_action: impl Fn(&T) -> () + 'static) -> Rc<dyn IObservable<Option<T>>>
    

    Runs action for each none, and else_action with each value (OnHasNoValue(Action, Action<T>)).

    Source

    select_values

    fn select_values(self: &Self) -> Rc<dyn IObservable<T>>
    

    The values; the nones are left out (SelectValues).

    Source

    value_or

    fn value_or(self: &Self, value_selector: impl Fn() -> T + 'static) -> Rc<dyn IObservable<T>>
    

    The values, with what value_selector makes in place of none (ValueOr).

    Source

    value_or_default

    fn value_or_default(self: &Self) -> Rc<dyn IObservable<T>>
    where T: Default
    

    The values, with the default value of T in place of none (ValueOrDefault).

    Source

    value_or_throw

    fn value_or_throw(self: &Self, exception_generator: impl Fn() -> ObservableError + 'static) -> Rc<dyn IObservable<T>>
    

    The values; a none ends the sequence with the error of exception_generator (ValueOrThrow).

    Source

    edit_diff_optional

    fn edit_diff_optional<K: Eq + std::hash::Hash + Clone + 'static>(self: &Self, key_selector: impl Fn(&T) -> K + 'static) -> Rc<dyn IObservable<crate::cache::ChangeSet<T, K>>>
    where T: PartialEq
    

    The changes of a cache that holds the value of the option, keyed by key_selector: a value adds it, another value with the same key updates it unless it is equal, one with another key replaces it, and none removes it (EditDiff(IObservable<Optional<TObject>>, Func<TObject, TKey>), equality of PartialEq).

    Source

    edit_diff_optional_with_comparer

    fn edit_diff_optional_with_comparer<K: Eq + std::hash::Hash + Clone + 'static>(self: &Self, key_selector: impl Fn(&T) -> K + 'static, equality_comparer: impl Fn(&T, &T) -> bool + 'static) -> Rc<dyn IObservable<crate::cache::ChangeSet<T, K>>>
    

    edit_diff_optional with the equality of equality_comparer (EditDiff(.., IEqualityComparer<TObject>)).

    Source

    Trait implementations

    Availability

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