Skip to main content

MapFold

Struct MapFold 

Source
pub struct MapFold<L1, L2, S, F, M>
where F: Fold<L2, S>, M: Fn(&L1) -> L2,
{ /* private fields */ }
Expand description

Map fold — transform entries before folding.

Implementations§

Source§

impl<L1, L2, S, F, M> MapFold<L1, L2, S, F, M>
where F: Fold<L2, S>, M: Fn(&L1) -> L2,

Source

pub fn new(inner: F, mapper: M) -> Self

Create a map fold.

Trait Implementations§

Source§

impl<L1, L2, S, F, M> Fold<L1, S> for MapFold<L1, L2, S, F, M>
where F: Fold<L2, S>, M: Fn(&L1) -> L2,

Source§

fn initial(&self, context: &FoldContext) -> S

Get the initial state before any entries are processed.
Source§

fn step(&self, state: S, entry: &L1, context: &FoldContext) -> S

Process a single entry and return the new state. Read more
Source§

fn finalize(&self, state: S, context: &FoldContext) -> S

Finalize the state after all entries are processed. Read more
Source§

fn derive<'a, I>(&self, entries: I, context: &FoldContext) -> FoldOutcome<S>
where Self: Sized, I: IntoIterator<Item = &'a L>, L: 'a,

Derive state from an iterator of entries. Read more
Source§

fn derive_filtered<'a, I, F>( &self, entries: I, context: &FoldContext, filter: F, ) -> FoldOutcome<S>
where Self: Sized, I: IntoIterator<Item = &'a L>, L: 'a, F: Fn(&L) -> bool,

Derive state with a filter.

Auto Trait Implementations§

§

impl<L1, L2, S, F, M> Freeze for MapFold<L1, L2, S, F, M>
where F: Freeze, M: Freeze,

§

impl<L1, L2, S, F, M> RefUnwindSafe for MapFold<L1, L2, S, F, M>

§

impl<L1, L2, S, F, M> Send for MapFold<L1, L2, S, F, M>
where F: Send, M: Send, L1: Send, L2: Send, S: Send,

§

impl<L1, L2, S, F, M> Sync for MapFold<L1, L2, S, F, M>
where F: Sync, M: Sync, L1: Sync, L2: Sync, S: Sync,

§

impl<L1, L2, S, F, M> Unpin for MapFold<L1, L2, S, F, M>
where F: Unpin, M: Unpin, L1: Unpin, L2: Unpin, S: Unpin,

§

impl<L1, L2, S, F, M> UnsafeUnpin for MapFold<L1, L2, S, F, M>
where F: UnsafeUnpin, M: UnsafeUnpin,

§

impl<L1, L2, S, F, M> UnwindSafe for MapFold<L1, L2, S, F, M>

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, 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.