Foldable

Trait Foldable 

Source
pub trait Foldable: Sized {
    type Elm;

    // Required methods
    fn fold_left<B, F>(&self, b: B, f: F) -> B
       where F: Fn(B, &Self::Elm) -> B;
    fn fold_right<B, F>(&self, b: B, f: F) -> B
       where F: Fn(&Self::Elm, B) -> B;
}

Required Associated Types§

Required Methods§

Source

fn fold_left<B, F>(&self, b: B, f: F) -> B
where F: Fn(B, &Self::Elm) -> B,

Source

fn fold_right<B, F>(&self, b: B, f: F) -> B
where F: Fn(&Self::Elm, B) -> B,

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.

Implementations on Foreign Types§

Source§

impl<A> Foldable for Vec<A>

Source§

type Elm = A

Source§

fn fold_left<B, F>(&self, b: B, f: F) -> B
where F: Fn(B, &Self::Elm) -> B,

Source§

fn fold_right<B, F>(&self, b: B, f: F) -> B
where F: Fn(&Self::Elm, B) -> B,

Implementors§