Trait MutatorExt

Source
pub trait MutatorExt<T>: Mutator<T> + Sized
where T: Clone + 'static,
{ // Provided methods fn filter<F>(self, filter: F) -> FilterMutator<Self, F> where F: Fn(&T) -> bool + 'static { ... } fn map<To, Map, Parse>( self, map: Map, parse: Parse, ) -> MapMutator<T, To, Self, Parse, Map, fn(&To, f64) -> f64> where To: Clone + 'static, Map: Fn(&T) -> To, Parse: Fn(&To) -> Option<T> { ... } }
Expand description

A trait for convenience methods automatically implemented for all types that conform to Mutator<V>

Provided Methods§

Source

fn filter<F>(self, filter: F) -> FilterMutator<Self, F>
where F: Fn(&T) -> bool + 'static,

Create a mutator which wraps self but only produces values for which the given closure returns true

Source

fn map<To, Map, Parse>( self, map: Map, parse: Parse, ) -> MapMutator<T, To, Self, Parse, Map, fn(&To, f64) -> f64>
where To: Clone + 'static, Map: Fn(&T) -> To, Parse: Fn(&To) -> Option<T>,

Create a mutator which wraps self and transforms the values generated by self using the map closure. The second closure, parse, should apply the opposite transformation.

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, M> MutatorExt<T> for M
where M: Mutator<T>, T: Clone + 'static,