-
Notifications
You must be signed in to change notification settings - Fork 0
/
SuperAndSelf.rs
43 lines (40 loc) · 883 Bytes
/
SuperAndSelf.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
fn function() {
println!("called `function()`");
}
mod my {
pub fn indirect_call() {
print!("called `my::indirect_all()`,that ");
function();
{
use cool::function as root_cool_function;
print!("> ");
root_cool_function();
}
{
use self::cool::function as my_cool_function;
print!("> ");
my_cool_function();
}
{
use super::function as root_function;
print!("> ");
root_function();
}
}
fn function() {
println!("called `my::function()`");
}
mod cool {
pub fn function() {
println!("called `my::cool::function()");
}
}
}
mod cool {
pub fn function() {
println!("called `cool:function()`");
}
}
fn main() {
my::indirect_call();
}