Des exemples de code pour programmer en Rust
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

16 Zeilen
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. }