Fold

Trait Fold 

Source
pub trait Fold {
    // Required method
    fn fold(self, outer: Self) -> Self;
}
Expand description

A property that is folded to determine its final value.

In the example below, the chain of stroke values is folded into a single value: 4pt + red.

#set rect(stroke: red)
#set rect(stroke: 4pt)
#rect()

Note: Folding must be associative, i.e. any implementation must satisfy fold(fold(a, b), c) == fold(a, fold(b, c)).

Required Methods§

Source

fn fold(self, outer: Self) -> Self

Fold this inner value with an outer folded value.

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 Fold for bool

Source§

fn fold(self, _: Self) -> Self

Source§

impl<T> Fold for Vec<T>

Source§

fn fold(self, outer: Self) -> Self

Source§

impl<T, const N: usize> Fold for SmallVec<[T; N]>

Source§

fn fold(self, outer: Self) -> Self

Source§

impl<T: Clone + Fold> Fold for Arc<T>

Source§

fn fold(self, outer: Self) -> Self

Source§

impl<T: Fold> Fold for Option<T>

Source§

fn fold(self, outer: Self) -> Self

Implementors§