fn
function_with_same_name() {
println!("called `function_with_same_name()`
which is
in
the outermost scope");
}
mod
cool_mod {
pub
fn
function_with_same_name() {
println!("called `cool_mod::function_with_same_name()`
which is inside the `cool_mod` module
in
the outermost scope");
}
}
mod
my_mod {
fn
function_with_same_name() {
println!("called `my_mod::function_with_same_name()`
which is inside the `my_mod` module");
}
mod
cool_mod {
pub
fn
function_with_same_name() {
println!("called `my_mod::cool_mod::
function_with_same_name()` which is inside the
`cool_mod` module which is
in
turn inside `my_mod` module");
}
}
pub
fn
indirect_call() {
print!(
"called `my_mod::indirect_call()`, that\n> "
);
self
::function_with_same_name();
function_with_same_name();
self
::cool_mod::function_with_same_name();
super
::function_with_same_name();
}
}
fn
main() {
my_mod::indirect_call();
}