Function compute_module_key

Source
fn compute_module_key(
    name: &FileName,
    root_dir: Option<&Path>,
) -> Option<Vec<Symbol>>
Expand description

Computes a module key from a FileName, optionally relative to a root directory.

This function converts a file path like src/foo/bar.leo into a Vec<Symbol> key like ["foo", "bar"], suitable for inserting into the program’s module map.

§Arguments

  • name - The filename of the module, either real (from disk) or synthetic (custom).
  • root_dir - The root directory to strip from the path, if any.

§Returns

  • Some(Vec<Symbol>) - The computed module key.
  • None - If the path can’t be stripped or processed.