Skip to main content

OptionObservableExtensions

Trait OptionObservableExtensions 

Source
pub trait OptionObservableExtensions<T: Clone + 'static> {
Show 15 methods // Required method fn options(&self) -> Rc<dyn IObservable<Option<T>>>; // Provided methods fn convert<U: 'static>( &self, converter: impl Fn(T) -> U + 'static, ) -> Rc<dyn IObservable<Option<U>>> { ... } fn convert_optional<U: 'static>( &self, converter: impl Fn(T) -> Option<U> + 'static, ) -> Rc<dyn IObservable<Option<U>>> { ... } fn convert_or<U: 'static>( &self, converter: impl Fn(T) -> U + 'static, fallback_converter: impl Fn() -> U + 'static, ) -> Rc<dyn IObservable<U>> { ... } fn or_else( &self, fallback_operation: impl Fn() -> Option<T> + 'static, ) -> Rc<dyn IObservable<Option<T>>> { ... } fn on_has_value( &self, action: impl Fn(&T) + 'static, ) -> Rc<dyn IObservable<Option<T>>> { ... } fn on_has_value_with_else( &self, action: impl Fn(&T) + 'static, else_action: impl Fn() + 'static, ) -> Rc<dyn IObservable<Option<T>>> { ... } fn on_has_no_value( &self, action: impl Fn() + 'static, ) -> Rc<dyn IObservable<Option<T>>> { ... } fn on_has_no_value_with_else( &self, action: impl Fn() + 'static, else_action: impl Fn(&T) + 'static, ) -> Rc<dyn IObservable<Option<T>>> { ... } fn select_values(&self) -> Rc<dyn IObservable<T>> { ... } fn value_or( &self, value_selector: impl Fn() -> T + 'static, ) -> Rc<dyn IObservable<T>> { ... } fn value_or_default(&self) -> Rc<dyn IObservable<T>> where T: Default { ... } fn value_or_throw( &self, exception_generator: impl Fn() -> ObservableError + 'static, ) -> Rc<dyn IObservable<T>> { ... } fn edit_diff_optional<K: Eq + Hash + Clone + 'static>( &self, key_selector: impl Fn(&T) -> K + 'static, ) -> Rc<dyn IObservable<ChangeSet<T, K>>> where T: PartialEq { ... } fn edit_diff_optional_with_comparer<K: Eq + Hash + Clone + 'static>( &self, key_selector: impl Fn(&T) -> K + 'static, equality_comparer: impl Fn(&T, &T) -> bool + 'static, ) -> Rc<dyn IObservable<ChangeSet<T, K>>> { ... }
}
Expand description

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.

Required Methods§

Source

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

The sequence as the handle the operators take.

Provided Methods§

Source

fn convert<U: 'static>( &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

fn convert_optional<U: 'static>( &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

fn convert_or<U: 'static>( &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

fn or_else( &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

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

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

Source

fn on_has_value_with_else( &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

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

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

Source

fn on_has_no_value_with_else( &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

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

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

Source

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

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

Source

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

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

Source

fn value_or_throw( &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

fn edit_diff_optional<K: Eq + Hash + Clone + 'static>( &self, key_selector: impl Fn(&T) -> K + 'static, ) -> Rc<dyn IObservable<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

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

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

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: Clone + 'static> OptionObservableExtensions<T> for Rc<dyn IObservable<Option<T>>>

Source§

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

Implementors§