Let's say I have the following main.rs and lib.rs files. Why after doing the wildcard import self refers to testing::nested and not the main binary module anymore?
Could somebody point me to documentation where they explain this? I haven't been able to find it. Thanks!
// main.rs
use testing::nested::*;
fn main() {
self::hello();
}
// lib.rs (testing module)
pub mod nested {
pub hello() {
println!("hello from nested::hello");
}
}
It's not that self refers to the nested module, it's that the use statement creates a second binding for the function hello in the top-level module, so that function can now be referred to by two different paths.