dyn_import
dyn_import is a Rust macro crate that simplifies the process of dynamically importing modules from a specified directory. This can be especially useful for projects that need to load and use modules at runtime, making your Rust application more flexible and extensible.
Features
- Dynamic Module Import: Easily import modules from a directory at runtime using a simple macro.
- Flexible: Allows you to specify the directory and filtering criteria for the modules you want to import.
Installation
To use dyn_import in your Rust project, add it as a dependency in your Cargo.toml:
[]
= "0.1"
Or run the following command:
Usage
Suppose you have the following directory structure for your Rust project:
my_project/
│
├── Cargo.toml
│
└── src/
├── main.rs
|-- some_mod.rs
└── some_mod/
├── module_one.rs
└── module_two.rs
Here's how you can use the import_mods macro from dyn_import in your Rust project:
extern crate dyn_import;
use import_mods;
// Declare the parent module
// All child modules are added here
import_mods!;