Skip to main content

each_piece

Function each_piece 

Source
pub fn each_piece<E>(
    pieces: &mut [TilePiece],
    f: &mut impl FnMut(&mut TilePiece) -> Result<(), E>,
) -> Result<(), E>
Expand description

Apply f to every piece of a template, then to every piece nested in a projection body or a branch arm, depth first.

Rewriting a piece rewrites the tile: a tile’s text is rendered from its pieces, so what the program projects after a transform is what it renders, with no second copy to keep in step.