Module walk

Module walk 

Source
Expand description

Provides the capability to walk the in-memory model of an SDML module.

To use the model walker:

  1. Provide a type, say MyModuleWalker.
  2. Provide an implementation of SimpleModuleVisitor for MyModuleWalker.
  3. Implement any methods from the trait SimpleModuleVisitor of interest to you.
  4. Use the function walk_module_simple and provide the module you wish to walk and your walker.
#[derive(Debug, Default)]
pub struct MyModuleWalker {}

impl SimpleModuleVisitor for MyModuleWalker {
    // implement some methods...
}

walk_module_simple(
    &some_module,  // module to walk
    &mut MyModuleWalker::default(),
    false,         // ignore constraints
    true           // include members/variants
);

Traits§

SimpleModuleVisitor
The trait that captures the callbacks that walk_module_simple uses as it traverses the module.

Functions§

walk_module_simple
Walk the module module calling the relevant methods on walker.