Skip to main content

is_module_root

Function is_module_root 

Source
pub fn is_module_root(dir: &Path) -> bool
Expand description

Returns true when dir contains a module.json file at its root (i.e., dir is the on-disk location of a WDL module).

Directory walkers use this to recognize module boundaries: a directory that owns a module.json is the entrypoint of a separate module and should not be analyzed as part of an ancestor module.

ยงExamples

use wdl_modules::module::is_module_root;

let dir = tempfile::tempdir().unwrap();

// A directory without `module.json` is not a module root.
assert!(!is_module_root(dir.path()));

// Creating `module.json` inside it makes it a module root.
std::fs::write(dir.path().join("module.json"), b"{}").unwrap();
assert!(is_module_root(dir.path()));