vyre-build-scan
Build-time filesystem scanner for flat trait-impl registries.
What this crate does
vyre-build-scan turns a flat directory of .rs files into a typed, static registry constant at build time. The contributor drops a new file into the scanned directory and runs cargo build. No mod.rs edits, no central arrays, no linker tricks. The filesystem is the registry.
Usage
1. build.rs
2. Leaf file (src/gates/atomics.rs)
;
pub const GATE: Atomics = Atomics;
3. Parent module (src/gates/mod.rs)
dir!;
include!;
4. Generated constant
$OUT_DIR/gates_registry.rs emits:
pub static ALL_GATES: & = &;
Access it anywhere in the crate as crate::gates::ALL_GATES.
Why it exists
Central lists create merge conflicts. Every new gate, backend, or rule fights for the same line in mod.rs or the same slot in a global array. vyre-build-scan removes the contention entirely: the filesystem is the registry. Drop a file, expose a pub const, and the next build wires it in. Pure build-time codegen, zero runtime overhead, no linker-section magic.
Example scenarios
- Enforcement gates: one file per gate,
ALL_GATESdrives a validation pipeline. - Plugin backends: one file per backend,
ALL_BACKENDSpopulates a static dispatcher. - Detection rules: one file per rule,
ALL_RULESfeeds a scanning engine.
License
MIT OR Apache-2.0.