Skip to content

vox-rule-pack API Reference (generated)

Crate: vox-rule-pack · Version: 0.6.0 · Target: Library (lib.rs)

Declarative rule pack loader for code-audit detectors and Scientia heuristics. Zero heavy dependencies.

Declarative rule-pack loader. Loads YAML rule definitions used by vox-code-audit detectors and vox-publisher Scientia heuristics.

See docs/src/architecture/2026-05-09-detector-rule-ssot-design.md.

ModuleDescription
error—
types—
schema—
pack—
bench—
Dependency Topology, diagram 14 nodes, 3 edges: vox-cli → vox-rule-pack; vox-cli-ci → vox-rule-pack; vox-code-audit → vox-rule-packvox-rule-packvox-clivox-cli-civox-code-audit
Diagram source
graph {
direction: right
node vox_rule_pack: "vox-rule-pack"
node vox_cli: "vox-cli"
vox_cli -> vox_rule_pack
node vox_cli_ci: "vox-cli-ci"
vox_cli_ci -> vox_rule_pack
node vox_code_audit: "vox-code-audit"
vox_code_audit -> vox_rule_pack
}
Consumer CrateRole
vox-cliDirect workspace dependent
vox-cli-ciDirect workspace dependent
vox-code-auditDirect workspace dependent
KindSymbolSignatureSourceDescription
structbench::RuleBenchResultpub struct RuleBenchResultcrates/vox-rule-pack/src/bench.rs#L11-L20Per-rule precision/recall statistics from the fixture corpus.
structbench::BenchReportpub struct BenchReportcrates/vox-rule-pack/src/bench.rs#L24-L27Full bench report across all rules in a pack.
fnbench::run_benchpub fn run_bench(pack: &RulePack, fixtures_root: &Path) -> BenchReportcrates/vox-rule-pack/src/bench.rs#L35-L48Runs the bench against pack, resolving fixture files relative to fixtures_root. Fixture file naming convention: <rule-sub-id>_pos_*.txt and <rule-sub-id>_neg_*.txt inside <fixtures_root>/<rule-parent-id>/. For example, rule victory-claim/premature resolves to <fixtures_root>/victory-claim/premature_pos_*.txt.
typeerror::RulePackResultpub type RulePackResult<T> = Result<T, RulePackError>crates/vox-rule-pack/src/error.rs#L5—
enumerror::RulePackErrorpub enum RulePackErrorcrates/vox-rule-pack/src/error.rs#L8-L27—
structpack::CompiledRulepub struct CompiledRulecrates/vox-rule-pack/src/pack.rs#L14-L27A rule with its regex pre-compiled and metadata ready for runtime use.
fnpack::matches_linepub fn matches_line(&self, line: &str) -> boolcrates/vox-rule-pack/src/pack.rs#L31-L33Returns true if the compiled regex matches the given line.
fnpack::matches_in_contentpub fn matches_in_content(&self, content: &str) -> Vec<usize>crates/vox-rule-pack/src/pack.rs#L37-L45For MultilineRegex rules: returns 1-indexed line numbers of every match in content. Returns an empty vec for LineRegex and Substring kinds (use matches_line instead).
fnpack::regexpub fn regex(&self) -> &Regexcrates/vox-rule-pack/src/pack.rs#L48-L50Returns a reference to the pre-compiled regex.
structpack::RulePackpub struct RulePackcrates/vox-rule-pack/src/pack.rs#L56-L59Loaded, compiled rule pack. Build with [RulePack::load_from_str] or [RulePack::load_from_path]. Cheap to clone via Arc<RulePack>.
fnpack::load_from_strpub fn load_from_str(yaml: &str) -> RulePackResult<Self>crates/vox-rule-pack/src/pack.rs#L63-L79Parse and compile a rule pack from a YAML string.
fnpack::load_from_pathpub fn load_from_path(path: &Path) -> RulePackResult<Self>crates/vox-rule-pack/src/pack.rs#L82-L88Read a YAML file from disk and compile it.
fnpack::lenpub fn len(&self) -> usizecrates/vox-rule-pack/src/pack.rs#L91-L93Number of compiled rules in this pack.
fnpack::is_emptypub fn is_empty(&self) -> boolcrates/vox-rule-pack/src/pack.rs#L96-L98Returns true if there are no rules.
fnpack::rulepub fn rule(&self, id: &str) -> Option<&CompiledRule>crates/vox-rule-pack/src/pack.rs#L101-L103Look up a rule by its exact ID.
fnpack::rulespub fn rules(&self) -> &[CompiledRule]crates/vox-rule-pack/src/pack.rs#L106-L108Iterate all rules in declaration order.
fnpack::rules_for_languagepub fn rules_for_language(&self, lang: RuleLanguage) -> impl Iterator<Item = &CompiledRule>crates/vox-rule-pack/src/pack.rs#L111-L115Iterate only the rules that apply to the given language.
structschema::RuleFilepub struct RuleFilecrates/vox-rule-pack/src/schema.rs#L8-L11—
structschema::RuleSpecpub struct RuleSpeccrates/vox-rule-pack/src/schema.rs#L14-L31—
structschema::MatchSpecpub struct MatchSpeccrates/vox-rule-pack/src/schema.rs#L34-L39—
enumschema::MatchKindpub enum MatchKindcrates/vox-rule-pack/src/schema.rs#L43-L47—
enumschema::SkipScopepub enum SkipScopecrates/vox-rule-pack/src/schema.rs#L51-L58—
structschema::FixtureSpecpub struct FixtureSpeccrates/vox-rule-pack/src/schema.rs#L61-L66—
enumtypes::RuleSeveritypub enum RuleSeveritycrates/vox-rule-pack/src/types.rs#L8-L13—
enumtypes::RuleConfidencepub enum RuleConfidencecrates/vox-rule-pack/src/types.rs#L17-L21—
enumtypes::RuleLanguagepub enum RuleLanguagecrates/vox-rule-pack/src/types.rs#L25-L32—