Des exemples de code pour programmer en Rust
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
349 B

  1. mod sup_module{ // module parent
  2. fn a() -> i32 {
  3. 100
  4. }
  5. pub mod sub_module { // module enfant
  6. use super::a ; // accès à la fonction parentale a
  7. pub fn b() {
  8. println ! ("{}", a() ) ; // appelle la fonction parentale a
  9. }
  10. }
  11. }
  12. fn main() {
  13. sup_module::sub_module::b() ; // appelle la fonction b
  14. }