Skip to main content

AggregationCacheEx

Trait AggregationCacheEx 

Source
pub trait AggregationCacheEx<T: Clone + 'static, K: Eq + Hash + Clone + 'static> {
    // Required methods
    fn for_aggregation(&self) -> AggregateChangeSets<T>;
    fn avg<V: AggregateValue>(
        &self,
        value_selector: impl Fn(&T) -> V + 'static,
    ) -> Rc<dyn IObservable<<V::Number as AggregateNumber>::Average>>;
    fn avg_with<V: AggregateValue>(
        &self,
        value_selector: impl Fn(&T) -> V + 'static,
        empty_value: V::Number,
    ) -> Rc<dyn IObservable<<V::Number as AggregateNumber>::Average>>;
    fn count_cache(&self) -> Rc<dyn IObservable<usize>>;
    fn is_empty_cache(&self) -> Rc<dyn IObservable<bool>>;
    fn is_not_empty(&self) -> Rc<dyn IObservable<bool>>;
    fn maximum<R: Copy + PartialOrd + Default + 'static>(
        &self,
        value_selector: impl Fn(&T) -> R + 'static,
    ) -> Rc<dyn IObservable<R>>;
    fn maximum_with<R: Copy + PartialOrd + 'static>(
        &self,
        value_selector: impl Fn(&T) -> R + 'static,
        empty_value: R,
    ) -> Rc<dyn IObservable<R>>;
    fn minimum<R: Copy + PartialOrd + Default + 'static>(
        &self,
        value_selector: impl Fn(&T) -> R + 'static,
    ) -> Rc<dyn IObservable<R>>;
    fn minimum_with<R: Copy + PartialOrd + 'static>(
        &self,
        value_selector: impl Fn(&T) -> R + 'static,
        empty_value: R,
    ) -> Rc<dyn IObservable<R>>;
    fn std_dev<V: StdDevValue>(
        &self,
        value_selector: impl Fn(&T) -> V + 'static,
        fallback_value: V,
    ) -> Rc<dyn IObservable<f64>>;
    fn sum_cache<V: AggregateValue>(
        &self,
        value_selector: impl Fn(&T) -> V + 'static,
    ) -> Rc<dyn IObservable<V::Number>>;
}
Expand description

The aggregations of caches (the overloads of AggregationEx, AvgEx, CountEx, MaxEx, StdDevEx and SumEx on IObservable<IChangeSet<TObject, TKey>>).

Required Methods§

Source

fn for_aggregation(&self) -> AggregateChangeSets<T>

The change sets as aggregate change sets: an add, a remove, or an update as the remove of the previous item and the add of the current one; refreshes and moves are left out (ForAggregation<TObject, TKey>()).

Source

fn avg<V: AggregateValue>( &self, value_selector: impl Fn(&T) -> V + 'static, ) -> Rc<dyn IObservable<<V::Number as AggregateNumber>::Average>>

The average of the values of the items after each change set, zero when there are none (Avg(Func<TObject, TValue>)).

Source

fn avg_with<V: AggregateValue>( &self, value_selector: impl Fn(&T) -> V + 'static, empty_value: V::Number, ) -> Rc<dyn IObservable<<V::Number as AggregateNumber>::Average>>

avg with the value when there are no items (Avg(Func<TObject, TValue>, TValue emptyValue)).

Source

fn count_cache(&self) -> Rc<dyn IObservable<usize>>

The count of the items after each change set (Count<TObject, TKey>(), and Count<TObject>(IObservable<IDistinctChangeSet<TObject>>)).

Source

fn is_empty_cache(&self) -> Rc<dyn IObservable<bool>>

True at once, then whether there are no items after each change set (IsEmpty).

Source

fn is_not_empty(&self) -> Rc<dyn IObservable<bool>>

False at once, then whether there are items after each change set (IsNotEmpty).

Source

fn maximum<R: Copy + PartialOrd + Default + 'static>( &self, value_selector: impl Fn(&T) -> R + 'static, ) -> Rc<dyn IObservable<R>>

The greatest value of the items, R::default() when there are none, each time it changes (Maximum(Func<TObject, TResult>)).

Source

fn maximum_with<R: Copy + PartialOrd + 'static>( &self, value_selector: impl Fn(&T) -> R + 'static, empty_value: R, ) -> Rc<dyn IObservable<R>>

maximum with the value when there are no items (Maximum(Func<TObject, TResult>, TResult emptyValue)).

Source

fn minimum<R: Copy + PartialOrd + Default + 'static>( &self, value_selector: impl Fn(&T) -> R + 'static, ) -> Rc<dyn IObservable<R>>

The least value of the items, R::default() when there are none, each time it changes (Minimum(Func<TObject, TResult>)).

Source

fn minimum_with<R: Copy + PartialOrd + 'static>( &self, value_selector: impl Fn(&T) -> R + 'static, empty_value: R, ) -> Rc<dyn IObservable<R>>

minimum with the value when there are no items (Minimum(Func<TObject, TResult>, TResult emptyValue)).

Source

fn std_dev<V: StdDevValue>( &self, value_selector: impl Fn(&T) -> V + 'static, fallback_value: V, ) -> Rc<dyn IObservable<f64>>

The sample standard deviation of the values of the items after each change set, fallback_value for fewer than two items (StdDev(Func<TObject, TValue>, TValue fallbackValue)).

Source

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

The sum of the values of the items after each change set (Sum(Func<TObject, TValue>)).

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, K: Eq + Hash + Clone + 'static, C: IChangeSet<T, K>> AggregationCacheEx<T, K> for Rc<dyn IObservable<C>>

Source§

fn for_aggregation(&self) -> AggregateChangeSets<T>

Source§

fn avg<V: AggregateValue>( &self, value_selector: impl Fn(&T) -> V + 'static, ) -> Rc<dyn IObservable<<V::Number as AggregateNumber>::Average>>

Source§

fn avg_with<V: AggregateValue>( &self, value_selector: impl Fn(&T) -> V + 'static, empty_value: V::Number, ) -> Rc<dyn IObservable<<V::Number as AggregateNumber>::Average>>

Source§

fn count_cache(&self) -> Rc<dyn IObservable<usize>>

Source§

fn is_empty_cache(&self) -> Rc<dyn IObservable<bool>>

Source§

fn is_not_empty(&self) -> Rc<dyn IObservable<bool>>

Source§

fn maximum<R: Copy + PartialOrd + Default + 'static>( &self, value_selector: impl Fn(&T) -> R + 'static, ) -> Rc<dyn IObservable<R>>

Source§

fn maximum_with<R: Copy + PartialOrd + 'static>( &self, value_selector: impl Fn(&T) -> R + 'static, empty_value: R, ) -> Rc<dyn IObservable<R>>

Source§

fn minimum<R: Copy + PartialOrd + Default + 'static>( &self, value_selector: impl Fn(&T) -> R + 'static, ) -> Rc<dyn IObservable<R>>

Source§

fn minimum_with<R: Copy + PartialOrd + 'static>( &self, value_selector: impl Fn(&T) -> R + 'static, empty_value: R, ) -> Rc<dyn IObservable<R>>

Source§

fn std_dev<V: StdDevValue>( &self, value_selector: impl Fn(&T) -> V + 'static, fallback_value: V, ) -> Rc<dyn IObservable<f64>>

Source§

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

Implementors§