Rust中super关键字和self关键字的使用
随笔:
fn function() { println!("function global"); } pub mod mod1 { pub fn function() { super::function(); println!("function mod1"); } pub mod mod2 { fn function() { println!("mod1::mod2::function"); } pub fn call() { self::function(); } } } fn main() { mod1::function(); mod1::mod2::call(); }