eyeball_im_util::vector

Trait VectorObserverExt

Source
pub trait VectorObserverExt<T>: VectorObserver<T>
where T: Clone + 'static, <Self::Stream as Stream>::Item: VectorDiffContainer<Element = T>,
{ // Provided methods fn filter<F>(self, f: F) -> (Vector<T>, Filter<Self::Stream, F>) where F: Fn(&T) -> bool { ... } fn filter_map<U, F>(self, f: F) -> (Vector<U>, FilterMap<Self::Stream, F>) where U: Clone, F: Fn(T) -> Option<U> { ... } fn limit( self, limit: usize, ) -> (Vector<T>, Limit<Self::Stream, EmptyLimitStream>) { ... } fn dynamic_limit<L>(self, limit_stream: L) -> Limit<Self::Stream, L> where L: Stream<Item = usize> { ... } fn dynamic_limit_with_initial_value<L>( self, initial_limit: usize, limit_stream: L, ) -> (Vector<T>, Limit<Self::Stream, L>) where L: Stream<Item = usize> { ... } fn sort(self) -> (Vector<T>, Sort<Self::Stream>) where T: Ord { ... } fn sort_by<F>(self, compare: F) -> (Vector<T>, SortBy<Self::Stream, F>) where F: Fn(&T, &T) -> Ordering { ... } fn sort_by_key<F, K>( self, key_fn: F, ) -> (Vector<T>, SortByKey<Self::Stream, F>) where F: Fn(&T) -> K, K: Ord { ... } }
Expand description

Convenience methods for VectorObservers.

See that trait for which types implement this.

Provided Methods§

Source

fn filter<F>(self, f: F) -> (Vector<T>, Filter<Self::Stream, F>)
where F: Fn(&T) -> bool,

Filter the vector’s values with the given function.

Source

fn filter_map<U, F>(self, f: F) -> (Vector<U>, FilterMap<Self::Stream, F>)
where U: Clone, F: Fn(T) -> Option<U>,

Filter and map the vector’s values with the given function.

Source

fn limit( self, limit: usize, ) -> (Vector<T>, Limit<Self::Stream, EmptyLimitStream>)

Limit the observed values to limit.

See Limit for more details.

Source

fn dynamic_limit<L>(self, limit_stream: L) -> Limit<Self::Stream, L>
where L: Stream<Item = usize>,

Limit the observed values to a number of items determined by the given stream.

See Limit for more details.

Source

fn dynamic_limit_with_initial_value<L>( self, initial_limit: usize, limit_stream: L, ) -> (Vector<T>, Limit<Self::Stream, L>)
where L: Stream<Item = usize>,

Limit the observed values to initial_limit items initially, and update the limit with the value from the given stream.

See Limit for more details.

Source

fn sort(self) -> (Vector<T>, Sort<Self::Stream>)
where T: Ord,

Sort the observed values.

See Sort for more details.

Source

fn sort_by<F>(self, compare: F) -> (Vector<T>, SortBy<Self::Stream, F>)
where F: Fn(&T, &T) -> Ordering,

Sort the observed values with the given comparison function.

See SortBy for more details.

Source

fn sort_by_key<F, K>(self, key_fn: F) -> (Vector<T>, SortByKey<Self::Stream, F>)
where F: Fn(&T) -> K, K: Ord,

Sort the observed values with the given key function.

See SortBy for more details.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, O> VectorObserverExt<T> for O
where T: Clone + 'static, O: VectorObserver<T>, <Self::Stream as Stream>::Item: VectorDiffContainer<Element = T>,