KeyPathsChain

Struct KeyPathsChain 

Source
pub struct KeyPathsChain<T> { /* private fields */ }
Expand description

KeyPaths chain for composable operations

Implementations§

Source§

impl<T> KeyPathsChain<T>

Source

pub fn filter_by_keypath<V, F>( self, keypath: KeyPaths<T, V>, predicate: F, ) -> Self
where F: Fn(&V) -> bool,

Filter by keypath predicate

Source

pub fn map_keypath<V, F, R>( self, keypath: KeyPaths<T, V>, f: F, ) -> KeyPathsChain<R>
where F: Fn(&V) -> R,

Map over keypath values

Source

pub fn fold_keypath<V, F, B>( self, keypath: KeyPaths<T, V>, init: B, f: F, ) -> KeyPathResult<B>
where F: Fn(B, &V) -> B,

Fold over keypath values

Source

pub fn collect<B: FromIterator<T>>(self) -> B

Collect into a vector

Source

pub fn take(self, n: usize) -> Self

Take first n elements

Source

pub fn skip(self, n: usize) -> Self

Skip first n elements

Source

pub fn rev(self) -> Self

Reverse the collection

Auto Trait Implementations§

§

impl<T> Freeze for KeyPathsChain<T>

§

impl<T> RefUnwindSafe for KeyPathsChain<T>
where T: RefUnwindSafe,

§

impl<T> Send for KeyPathsChain<T>
where T: Send,

§

impl<T> Sync for KeyPathsChain<T>
where T: Sync,

§

impl<T> Unpin for KeyPathsChain<T>
where T: Unpin,

§

impl<T> UnwindSafe for KeyPathsChain<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> KeyPathsOperable for T

Source§

fn get_at_keypath<'a, V>( &'a self, keypath: &'a KeyPaths<Self, V>, ) -> KeyPathResult<&'a V>

Get a value at a keypath
Source§

fn set_at_keypath<V>( &mut self, _keypath: KeyPaths<Self, V>, _value: V, ) -> KeyPathResult<()>

Set a value at a keypath (if the keypath supports mutation)
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.