Skip to main content

FilterFold

Struct FilterFold 

Source
pub struct FilterFold<L, S, F, P>
where F: Fold<L, S>, P: Fn(&L) -> bool,
{ /* private fields */ }
Expand description

Filter fold — only process entries matching a predicate.

Implementations§

Source§

impl<L, S, F, P> FilterFold<L, S, F, P>
where F: Fold<L, S>, P: Fn(&L) -> bool,

Source

pub fn new(inner: F, predicate: P) -> Self

Create a filter fold.

Trait Implementations§

Source§

impl<L, S, F, P> Fold<L, S> for FilterFold<L, S, F, P>
where F: Fold<L, S>, P: Fn(&L) -> bool,

Source§

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

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

fn step(&self, state: S, entry: &L, 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<L, S, F, P> Freeze for FilterFold<L, S, F, P>
where F: Freeze, P: Freeze,

§

impl<L, S, F, P> RefUnwindSafe for FilterFold<L, S, F, P>

§

impl<L, S, F, P> Send for FilterFold<L, S, F, P>
where F: Send, P: Send, L: Send, S: Send,

§

impl<L, S, F, P> Sync for FilterFold<L, S, F, P>
where F: Sync, P: Sync, L: Sync, S: Sync,

§

impl<L, S, F, P> Unpin for FilterFold<L, S, F, P>
where F: Unpin, P: Unpin, L: Unpin, S: Unpin,

§

impl<L, S, F, P> UnsafeUnpin for FilterFold<L, S, F, P>
where F: UnsafeUnpin, P: UnsafeUnpin,

§

impl<L, S, F, P> UnwindSafe for FilterFold<L, S, F, P>

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.