engine.rs - Core Engine Generator
This tool initializes a specialized, deep-hierarchy Rust workspace (12-level tree) designed for any Rust project.
It solves the "multiple workspace roots" collision by establishing a single
source of truth at the features level while maintaining modularity across
nested packages.
Unlike standard scaffolders, this engine implements a Deep-Hash Manifest system:
Atomic Generation: Files are written with specific, compiler-ready boilerplate.
Manifesting: Every file's content is hashed using the BLAKE3 algorithm during creation.
Fail-Fast Verification: Before the process completes, the engine performs a second pass, reading every file from the disk to verify its hash against the manifest.
Zero-Tolerance: If a single byte is corrupted or a file fails to write, the engine triggers an immediate exit to prevent building on a broken foundation.
The generator builds the following structure to ensure the Rust compiler correctly recognizes nested modules across the filesystem:
engines/
└── yonasBSD/
└── models/
└── model-A/
└── features/ [Workspace Root]
├── Cargo.toml
└── feature-A/
└── packages/
├── traits/
│ ├── Cargo.toml
│ └── src/ (lib.rs)
└── package-A/
├── Cargo.toml
├── mod.rs
├── benches/
├── examples/
├── src/
├── vendor/
├── tests/
│ └── common/
├── enums/
│ ├── mod.rs
│ └── tests/ (unit, integration)
├── utils/
│ ├── mod.rs
│ └── tests/ (unit, integration)
├── traits/
│ ├── mod.rs
│ └── tests/ (unit, integration)
└── core/
├── mod.rs
├── internal/
│ ├── mod.rs
│ └── tests/ (unit, integration)
├── backends/
│ ├── mod.rs
│ └── tests/ (unit, integration)
└── frontends/
├── Cargo.toml
├── src/ (lib.rs)
└── tests/ (unit, integration)
- Rust: 1.56+ (2021 Edition)
To generate the project structure:
cargo run --releaseCargo restricts workspaces to a single root. This structure bypasses nested workspace errors by:
- Workspace Anchoring: The [workspace] definition is placed at the features level to allow deep nesting without root collisions.
- Boilerplate Injection: Automatically populates mod.rs and lib.rs to ensure every level is reachable by the compiler via pub mod declarations.
- Fail-Fast Verification: If any generated file does not match the hardcoded BLAKE3 hash, the build is flagged as compromised.
The generator automatically populates mod.rs and lib.rs files to ensure every directory in the 12-level tree is reachable by the compiler. It adheres to a strict "one declaration per line" format for pub mod and use statements.
- Traits Package: Defines the core ModelComponent trait.
- Logic Tests: Pre-configured integration_logic.rs and structure.rs for immediate validation.
- Support Trees: Comprehensive directory mapping for unit and integration tests across all sub-modules.
Note
Every generated directory includes a README.md anchor to ensure directory persistence across version control systems.
