Skip to main content

TryFold

Trait TryFold 

Source
pub trait TryFold<L, S>: Fold<L, S> {
    // Required method
    fn try_step(
        &self,
        state: S,
        entry: &L,
        context: &FoldContext,
    ) -> Result<S, FoldFailure>;
}
Expand description

Fallible fold step API for reducers that can reject invalid state shapes.

Required Methods§

Source

fn try_step( &self, state: S, entry: &L, context: &FoldContext, ) -> Result<S, FoldFailure>

Process a single entry and return an error instead of panicking.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<L, S, T> TryFold<L, S> for Box<T>
where T: TryFold<L, S> + ?Sized,

Source§

fn try_step( &self, state: S, entry: &L, context: &FoldContext, ) -> Result<S, FoldFailure>

Source§

impl<L, S, T> TryFold<L, S> for Arc<T>
where T: TryFold<L, S> + ?Sized,

Source§

fn try_step( &self, state: S, entry: &L, context: &FoldContext, ) -> Result<S, FoldFailure>

Implementors§

Source§

impl<L> TryFold<L, CommonFoldState> for CommonFold<L>

Source§

impl<L> TryFold<L, bool> for AnyFold<L>

Source§

impl<L> TryFold<L, i64> for SumI64Fold<L>

Source§

impl<L> TryFold<L, usize> for CountFold<L>

Source§

impl<L> TryFold<L, usize> for FilterCountFold<L>

Source§

impl<L, S, I, St, F> TryFold<L, S> for FnFold<L, S, I, St, F>
where L: Send + Sync, S: Send + Sync, I: Fn(&FoldContext) -> S + Send + Sync, St: Fn(S, &L, &FoldContext) -> S + Send + Sync, F: Fn(S, &FoldContext) -> S + Send + Sync,