| Crates.io | barexp |
| lib.rs | barexp |
| version | 1.1.1 |
| created_at | 2024-12-13 17:04:58.039985+00 |
| updated_at | 2024-12-13 20:48:59.84609+00 |
| description | A Rust library that automatically generates mod.rs files for your project |
| homepage | |
| repository | https://github.com/krcpa/barexp |
| max_upload_size | |
| id | 1482366 |
| size | 10,404 |
Automatically generates mod.rs files for your Rust project's subdirectories. This crate simplifies module management by automatically creating and maintaining mod.rs files with proper module declarations and re-exports.
mod.rs filespub usetarget directorylib.rs or main.rsAdd this to your Cargo.toml:
[build-dependencies]
barexp = "1.1.0"
build.rs file in your project root:fn main() {
barexp::build();
}
That's it! The crate will automatically:
src directory recursivelymod.rs files in subdirectoriesmod.rs files when neededBefore:
src/
├── lib.rs
├── services/
│ ├── crypto.rs
│ └── user.rs
└── models/
├── account.rs
└── transaction.rs
After:
src/
├── lib.rs
├── services/
│ ├── mod.rs // Auto-generated
│ ├── crypto.rs
│ └── user.rs
└── models/
├── mod.rs // Auto-generated
├── account.rs
└── transaction.rs
Generated mod.rs content example:
pub mod crypto;
pub mod user;
pub use self::{
crypto::*,
user::*,
};
During the build process, the crate:
src folder.rs)mod.rs filesThe crate preserves:
src/lib.rs or src/main.rstarget directoryCurrently, the crate works with default settings. Future versions will include:
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
pub mod)pub use)