Skip to main content

each_statement

Function each_statement 

Source
pub fn each_statement<E>(
    statements: &mut [Statement],
    f: &mut impl FnMut(&mut Statement) -> Result<(), E>,
) -> Result<(), E>
Expand description

Apply f to every statement in statements, then to every statement nested in a module body or a for body, depth first.

f sees a statement before its own nested bodies are walked, so a transform may rewrite a statement and have the walk continue into what it wrote.