diff --git a/presentation/codes/library/Cargo.toml b/presentation/codes/library/Cargo.toml index fc46dddb1dc3237925ea1054e234548100065d3d..25eed0b0b3bf083ca4dc0db8ded17f425b1566f1 100644 --- a/presentation/codes/library/Cargo.toml +++ b/presentation/codes/library/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "library" +name = "ownership" version = "0.1.0" authors = ["Orestis Malaspinas <orestis.malaspinas@hesge.ch>"] edition = "2018" diff --git a/presentation/codes/library/src/main.rs b/presentation/codes/library/src/main.rs index 4431bb13259d7bdd6ec0447c64dc8ea7443ec5d7..f249b163dd568ad43afd25cc12e47efd935b55cc 100644 --- a/presentation/codes/library/src/main.rs +++ b/presentation/codes/library/src/main.rs @@ -3,11 +3,11 @@ fn do_something(library: Vec<&str>) { } fn main() { - let mut library = Vec::new(); + let mut notebook = Vec::new(); // par défaut notebook est immutable - library.push("Les fleurs du Mal."); - library.push("Rust Programming."); + library.push("Il fait beau."); + library.push("Lea oiseaux chantent."); - do_something(library); - do_something(library); // redo something + do_something(library); // ownership transféré à do_something + // do_something(library); // redo something }