Hello,
My project looks like :
- modules
project/src/module1/mod.rs
/module2/mod.rs
...
- examples
project/examples/my_example.rs
And I want to import the modules inside my examples but I found no documentation about this + my understanding about import mechanics is not danky.
Thanks in advance 
H2CO3
2
Doesn't use crate_name::module1;
work?
kpreid
3
@H2CO3 's suggestion will work assuming that you have a lib.rs
which declares mod module1;
.
If that's not your goal, or it still doesn't work, please share the entire file listing of your project, and what errors you get.
3 Likes
As @kpreid said, the solution was including a project/src/lib.rs
file containing these lines.
pub mod module1;
pub mod module2;
And then importing these modules inside my project/examples/example_one.rs
like this :
use project::module1;
use project::module2;
Special thanks to @Yandros who gave me the full solution.
1 Like
system
Closed
5
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.