-
Notifications
You must be signed in to change notification settings - Fork 8
Project Structure
Ashish Kankal edited this page Dec 30, 2020
·
2 revisions
Folder structure to follow for the modules
.
├── Cargo.lock
├── Cargo.toml
├── src/
│ ├── lib.rs
│ ├── module_1.rs
│ ├── module_2.rs
│ ├── module_3.rs
│ ├── ...
│ ├── module_1/
│ ├── module_2/
│ ├── module_3/
│ ├── ...
├── examples/
│ ├── main.rs
│ │── ssl_tls/
│ │ │── main.rs
│ │ └── sub_main.rs
│ └── module_2/
│ ├── main.rs
│ └── sub_main.rs
│ └── ../
└── tests/
├── some-integration-tests.rs
- Create a [module_name].rs
in
src` folder - Add
pub mod [module_name];
inlib.rs
- Create a
[module_name]/
folder. - Create
[submodule_name].rs
for respective submodules inside the folder created in step 1. - Create a
[module_name].rs
insrc
folder. - Add
pub mod [submodule_name];
in[module_name].rs for each submodule
. - Add
pub mod [module_name];
inlib.rs
- Create
[module_name]_example.rs
or[submodule_name]_example.rs
in the examples folder - Import the crate to demonstrate the associated functionalities.
- Use command
cargo run --example [filename].rs
to run the example.