spirt

Module func_at

source
Expand description

Traversal helpers for intra-function entities.

FuncAt<P>/FuncAtMut<P> are like (&FuncDefBody, P)/(&mut FuncDefBody, P) (where P is some type describing a “position” in the function), except:

  • they only borrow the EntityDefs fields of FuncDefBody
    • this can prevent borrow conflicts, especially when mutating other fields
    • it also avoids accidentally accessing parts of the function definition without going through P (as EntityDefs requires keys for any access)
  • they’re dedicated types with inherent methods and trait impls

Structs§

  • Immutable traversal (i.e. visiting) helper for intra-function entities.
  • Mutable traversal (i.e. transforming) helper for intra-function entities.