Skip to main content

scan_rules_dir

Function scan_rules_dir 

Source
pub fn scan_rules_dir(rules_dir: &Path) -> Result<Vec<RawRuleFile>, Error>
Expand description

Scan a directory for *.json rule files. Returns one RawRuleFile per discovered file with path populated from the on-disk filename. Order of the returned vector is unspecified — the merge stage sorts by (order asc, path lex) so the loader does not pre-sort.

§Errors

Returns Error::compile when:

  • rules_dir does not exist (an empty directory is fine, but a missing one is operator error and should fail loud).
  • rules_dir exists but is not a directory.
  • any .json file fails to parse as RawRuleFile.

Returns Error::io for filesystem-level read failures (permission denied, broken symlink during traversal, etc.).