Why do I need to write mod and use when I want to bring a module to the scope?
mod from_other_file;
use from_other_file::sub_module;
fn main() {
sub_module::do_something();
}
If I do this it gives me error because the module isn't imported inside the current file:
use from_other_file::sub_module;
fn main() {
sub_module::do_something();
}
Error Message:
error[E0432]: unresolved import `from_other_file`
--> src/main.rs:1:5
|
1 | use from_other_file::sub_module;
| ^^^^^^^^^^^^^^^ use of undeclared type or module `from_other_file`