From 37921c5cccbb0db1bd7d63135de4119d4c7952bd Mon Sep 17 00:00:00 2001 From: Orestis Malaspinas <orestis.malaspinas@hesge.ch> Date: Wed, 8 May 2019 16:32:04 +0200 Subject: [PATCH] mises a jour diverses --- presentation/codes/ownership/src/main.rs | 16 ++++++++++++---- presentation/intro.md | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/presentation/codes/ownership/src/main.rs b/presentation/codes/ownership/src/main.rs index dc2cf2c..cfa9431 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 ec6935e..e73e3c9 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 -- GitLab