I am used to organising files in separate directories depending on the problem domain (for example grouping image processing stuff together, IO stuff in another directory etc). I am not sure if this way or organisation is even recommended in Rust.
I have setup my project in multiple directories:
- helloworld
- Cargo.toml
- src
- main.rs
- test
- one.rs
I am trying to use a function from one.rs
in main.rs
one.rs
fn test() {
println!("Calling test...");
}
main.rs
use test::one::*;
fn main() {
println!("Hello, world!");
test();
}
This results in a compile time error:
error[E0432]: unresolved import `test::one::*`
--> src/main.rs:1:5
|
1 | use test::one::*;
| ^^^^^^^^^^^^^ Maybe a missing `extern crate test;`?
error[E0425]: cannot find function `test` in this scope
--> src/main.rs:6:5
|
6 | test();
| ^^^^ not found in this scope
Looking at some online projects, it seems like something like this should be possible.