fold

Function fold 

Source
pub fn fold(
    xs: &[impl Format],
    op: impl FnMut(Document, Document) -> Document,
) -> Document
Expand description

Collapses a list of documents according to op. If the slice is empty, returns nil.

Examples found in repository?
examples/c_subset.rs (line 58)
57    fn sep(xs: &[impl Format], sep: &str) -> Document {
58        fold(xs, |lhs, rhs| lhs & text(sep) + rhs)
59    }