Expand description
Build-time filesystem scanner. Emits a typed registry from a flat directory
of .rs files, so adding a new responsibility is one file drop with zero
modifications to any other file.
§build.rs example
vyre_build_scan::scan(&vyre_build_scan::Registry {
scan_dir: "src/enforce/gates",
const_name: "ALL_GATES",
element_type: "&'static dyn crate::enforce::EnforceGate",
item_const_name: "REGISTERED",
output_file: "gates_registry.rs",
module_prefix: "crate::enforce::gates",
});§Model
Every responsibility directory follows this shape:
src/gates/
mod.rs - declares: `automod::dir!(pub "src/gates");`
plus: `include!(concat!(env!("OUT_DIR"), "/gates_registry.rs"));`
atomics.rs - exposes: `pub const GATE: Atomics = Atomics;`
barrier.rs - exposes: `pub const GATE: Barrier = Barrier;`
oob.rs - ...Build-time, scan walks src/gates/, reads every .rs file other than
mod.rs and filenames starting with _, and writes
$OUT_DIR/gates_registry.rs containing a flat slice referencing the
constants.
The contributor adds src/gates/my_gate.rs with one
pub const GATE: MyGate = MyGate; declaration. Nothing else in the tree
changes. cargo build wires it in.
This is the collision-free single-responsibility enforcement mechanism: no
central list of registrations, no manual pub mod edits, no inventory
linker-section magic. Pure filesystem scanning, build-time codegen, and
static dispatch.
Structs§
- Registry
- Description of one flat responsibility registry to emit from
build.rs. - Rust
Spec Registry - Description of one Rust-source
OpSpecregistry to emit frombuild.rs.
Functions§
- scan
- Scan a flat directory of
.rsfiles and emit a typed registry. - scan_
all - Run
scanfor multiple registries in a single build script. - scan_
rust_ specs - Scan Rust source trees for public
OpSpecconstants and emit a registry.