diff --git a/presentation/codes/ownership/src/main.rs b/presentation/codes/ownership/src/main.rs index dc2cf2cc5b4f8f6cb5f1758b903022c0a9b1a732..cfa94314079f432d5e8e66f7bd171b96c95bfa50 100644 --- a/presentation/codes/ownership/src/main.rs +++ b/presentation/codes/ownership/src/main.rs @@ -1,13 +1,21 @@ -fn do_something(_notebook: Vec<&str>) { // _notebook prend l'ownership +fn do_something(_notebook: Vec<String>) { // _notebook prend l'ownership // Do something with the library } // _notebook est détruit et ses données aussi fn main() { let mut notebook = Vec::new(); // par défaut notebook est immutable - notebook.push("Il fait beau."); - notebook.push("Les oiseaux chantent."); + notebook.push(String::from("Il fait beau.")); + notebook.push(String::from("Les oiseaux chantent.")); do_something(notebook); // ownership transféré à do_something // do_something(notebook); // redo something -} \ No newline at end of file + + let a = 1; + let raw = &a as *const i32; + + let b = unsafe { + *raw + }; + println!("{}", unsafe { *raw }); +} diff --git a/presentation/intro.md b/presentation/intro.md index ec6935eb3df884b698d237ad9fabe31e4dc91661..e73e3c9e919e42d4d9fe0b81bb3bbbb47789dd41 100644 --- a/presentation/intro.md +++ b/presentation/intro.md @@ -16,7 +16,7 @@ pdfMaxPagesPerSlide: - Rendu public la première fois en 2012 (version 0.4). - Première version stable (1.0) en 2015. - Stabilisation de fonctionnalités tous les 6 semaines. -- Version stable actuelle 1.31.1 <!-- TODO UPDATE --> +- Version stable actuelle 1.32. <!-- TODO UPDATE --> ## Un développement pragmatique