Skip to main content

compile_rules

Function compile_rules 

Source
pub fn compile_rules(text: &str) -> Result<CompiledRules, LoadError>
Expand description

Re-exports the forbidden-regex rule compiler’s public surface. Compiles a rule source into a combined RegexSet plus its per-rule names.

Parses the autodetected format (escaping literals, applying the flag policy, stripping a BOM), then validates each rule through the engine to attribute a redacted, index-bearing error to the first offender, and finally assembles the combined set. Validation and assembly both go through RegexSet::new, so no pattern is ever logged. Errors carry only an opaque rule index and the engine’s static reason, never rule text.