Trait TryAcc

Source
pub trait TryAcc: Sized {
    type Error;
    type Item;

    // Required method
    fn try_acc(self, item: Self::Item) -> Result<Self, Self::Error>;
}
Expand description

This is very usefull to be use on combinator like try_fold. For example, .try_fold_bounds(.., || Ok(Vec::new), TryAcc::try_acc).

Required Associated Types§

Source

type Error

The error returned by the collection if push fail

Source

type Item

Item stocked in the collection

Required Methods§

Source

fn try_acc(self, item: Self::Item) -> Result<Self, Self::Error>

Try to accumulate item into Self. For example, for a vector that simply a try_push.

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> TryAcc for T
where Self: TryPush,

Source§

type Error = <T as TryPush>::Error

Source§

type Item = <T as TryPush>::Item