From 5205fd232e7149891a260fa782b681e625ce2a9e Mon Sep 17 00:00:00 2001 From: AdrienBaudemont <59776880+AdrienBaudemont@users.noreply.github.com> Date: Fri, 8 Sep 2023 08:36:13 -0400 Subject: [PATCH] fr: Update the fr.po file with new English messages (msgmerge). (#1180) --- po/fr.po | 9536 +++++++++++++++++++++++++++++------------------------- 1 file changed, 5165 insertions(+), 4371 deletions(-) diff --git a/po/fr.po b/po/fr.po index b90ecd4c..ee6ee62a 100644 --- a/po/fr.po +++ b/po/fr.po @@ -12,127 +12,127 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 3.3.2\n" -#: src/SUMMARY.md:3 src/welcome.md:1 +#: src/SUMMARY.md:4 src/index.md:1 msgid "Welcome to Comprehensive Rust 🦀" msgstr "Bienvenue à Comprehensive Rust (le guide complet de Rust) 🦀" -#: src/SUMMARY.md:4 src/running-the-course.md:1 +#: src/SUMMARY.md:5 src/running-the-course.md:1 msgid "Running the Course" msgstr "Comment présenter le cours" -#: src/SUMMARY.md:5 src/running-the-course/course-structure.md:1 +#: src/SUMMARY.md:6 src/running-the-course/course-structure.md:1 msgid "Course Structure" msgstr "Structure du cours" -#: src/SUMMARY.md:6 src/running-the-course/keyboard-shortcuts.md:1 +#: src/SUMMARY.md:7 src/running-the-course/keyboard-shortcuts.md:1 msgid "Keyboard Shortcuts" msgstr "Raccourcis clavier" -#: src/SUMMARY.md:7 src/running-the-course/translations.md:1 +#: src/SUMMARY.md:8 src/running-the-course/translations.md:1 msgid "Translations" msgstr "Traductions" -#: src/SUMMARY.md:8 src/cargo.md:1 +#: src/SUMMARY.md:9 src/cargo.md:1 msgid "Using Cargo" msgstr "Utiliser Cargo" -#: src/SUMMARY.md:9 +#: src/SUMMARY.md:10 msgid "Rust Ecosystem" msgstr "Écosystème de Rust" -#: src/SUMMARY.md:10 +#: src/SUMMARY.md:11 msgid "Code Samples" msgstr "Exemples de code" -#: src/SUMMARY.md:11 +#: src/SUMMARY.md:12 msgid "Running Cargo Locally" msgstr "Exécuter Cargo localement" -#: src/SUMMARY.md:14 +#: src/SUMMARY.md:15 msgid "Day 1: Morning" msgstr "Jour 1 : Matin" -#: src/SUMMARY.md:18 src/SUMMARY.md:75 src/SUMMARY.md:128 src/SUMMARY.md:185 -#: src/SUMMARY.md:211 src/SUMMARY.md:261 +#: src/SUMMARY.md:19 src/SUMMARY.md:79 src/SUMMARY.md:134 src/SUMMARY.md:192 +#: src/SUMMARY.md:218 src/SUMMARY.md:268 msgid "Welcome" msgstr "Bienvenue" -#: src/SUMMARY.md:19 src/welcome-day-1/what-is-rust.md:1 +#: src/SUMMARY.md:20 src/welcome-day-1/what-is-rust.md:1 msgid "What is Rust?" msgstr "Qu'est-ce que Rust ?" -#: src/SUMMARY.md:20 src/hello-world.md:1 +#: src/SUMMARY.md:21 src/hello-world.md:1 msgid "Hello World!" msgstr "Bonjour le monde!" -#: src/SUMMARY.md:21 src/hello-world/small-example.md:1 +#: src/SUMMARY.md:22 src/hello-world/small-example.md:1 msgid "Small Example" msgstr "Petit exemple" -#: src/SUMMARY.md:22 src/why-rust.md:1 +#: src/SUMMARY.md:23 src/why-rust.md:1 msgid "Why Rust?" msgstr "Pourquoi Rust ?" -#: src/SUMMARY.md:23 src/why-rust/compile-time.md:1 +#: src/SUMMARY.md:24 src/why-rust/compile-time.md:1 msgid "Compile Time Guarantees" msgstr "Garanties à la compilation" -#: src/SUMMARY.md:24 src/why-rust/runtime.md:1 +#: src/SUMMARY.md:25 src/why-rust/runtime.md:1 msgid "Runtime Guarantees" msgstr "Garanties à l'exécution" -#: src/SUMMARY.md:25 src/why-rust/modern.md:1 +#: src/SUMMARY.md:26 src/why-rust/modern.md:1 msgid "Modern Features" msgstr "Fonctionnalités modernes" -#: src/SUMMARY.md:26 src/basic-syntax.md:1 +#: src/SUMMARY.md:27 src/basic-syntax.md:1 msgid "Basic Syntax" msgstr "Syntaxe de base" -#: src/SUMMARY.md:27 src/basic-syntax/scalar-types.md:1 +#: src/SUMMARY.md:28 src/basic-syntax/scalar-types.md:1 msgid "Scalar Types" msgstr "Types scalaires" -#: src/SUMMARY.md:28 src/basic-syntax/compound-types.md:1 +#: src/SUMMARY.md:29 src/basic-syntax/compound-types.md:1 msgid "Compound Types" msgstr "Types composés" -#: src/SUMMARY.md:29 src/basic-syntax/references.md:1 +#: src/SUMMARY.md:30 src/basic-syntax/references.md:1 msgid "References" msgstr "Références" -#: src/SUMMARY.md:30 src/basic-syntax/references-dangling.md:1 +#: src/SUMMARY.md:31 src/basic-syntax/references-dangling.md:1 msgid "Dangling References" msgstr "Références invalides" -#: src/SUMMARY.md:31 src/basic-syntax/slices.md:1 +#: src/SUMMARY.md:32 src/basic-syntax/slices.md:1 msgid "Slices" msgstr "Tranches" -#: src/SUMMARY.md:32 +#: src/SUMMARY.md:33 msgid "String vs str" msgstr "String vs str" -#: src/SUMMARY.md:33 src/basic-syntax/functions.md:1 +#: src/SUMMARY.md:34 src/basic-syntax/functions.md:1 msgid "Functions" msgstr "Fonctions" -#: src/SUMMARY.md:34 src/basic-syntax/rustdoc.md:1 +#: src/SUMMARY.md:35 src/basic-syntax/rustdoc.md:1 msgid "Rustdoc" msgstr "Rustdoc" -#: src/SUMMARY.md:35 src/SUMMARY.md:82 src/basic-syntax/methods.md:1 +#: src/SUMMARY.md:36 src/SUMMARY.md:102 src/basic-syntax/methods.md:1 #: src/methods.md:1 msgid "Methods" msgstr "Méthodes" -#: src/SUMMARY.md:36 +#: src/SUMMARY.md:37 msgid "Overloading" msgstr "Surcharge" -#: src/SUMMARY.md:37 src/SUMMARY.md:66 src/SUMMARY.md:90 src/SUMMARY.md:119 -#: src/SUMMARY.md:148 src/SUMMARY.md:177 src/SUMMARY.md:204 src/SUMMARY.md:225 -#: src/SUMMARY.md:253 src/SUMMARY.md:275 src/SUMMARY.md:296 +#: src/SUMMARY.md:38 src/SUMMARY.md:71 src/SUMMARY.md:105 src/SUMMARY.md:125 +#: src/SUMMARY.md:154 src/SUMMARY.md:184 src/SUMMARY.md:211 src/SUMMARY.md:232 +#: src/SUMMARY.md:260 src/SUMMARY.md:282 src/SUMMARY.md:303 #: src/exercises/android/morning.md:1 src/exercises/bare-metal/morning.md:1 #: src/exercises/bare-metal/afternoon.md:1 #: src/exercises/concurrency/morning.md:1 @@ -140,919 +140,916 @@ msgstr "Surcharge" msgid "Exercises" msgstr "Exercices" -#: src/SUMMARY.md:38 src/exercises/day-1/implicit-conversions.md:1 +#: src/SUMMARY.md:39 src/exercises/day-1/implicit-conversions.md:1 msgid "Implicit Conversions" msgstr "Conversions implicites" -#: src/SUMMARY.md:39 +#: src/SUMMARY.md:40 msgid "Arrays and for Loops" msgstr "Tableaux et boucles for" -#: src/SUMMARY.md:41 +#: src/SUMMARY.md:42 msgid "Day 1: Afternoon" msgstr "Jour 1 : Après-midi" -#: src/SUMMARY.md:43 src/basic-syntax/variables.md:1 +#: src/SUMMARY.md:44 src/SUMMARY.md:295 src/control-flow.md:1 +msgid "Control Flow" +msgstr "Flux de contrôle" + +#: src/SUMMARY.md:45 src/control-flow/blocks.md:1 +msgid "Blocks" +msgstr "Blocs" + +#: src/SUMMARY.md:46 +msgid "if expressions" +msgstr "expressions `if`" + +#: src/SUMMARY.md:47 +msgid "for expressions" +msgstr "expressions `for`" + +#: src/SUMMARY.md:48 +msgid "while expressions" +msgstr "while expressions" + +#: src/SUMMARY.md:49 +msgid "break & continue" +msgstr "break & continue" + +#: src/SUMMARY.md:50 +msgid "loop expressions" +msgstr "expressions `loop`" + +#: src/SUMMARY.md:52 src/basic-syntax/variables.md:1 msgid "Variables" msgstr "Variables" -#: src/SUMMARY.md:44 src/basic-syntax/type-inference.md:1 +#: src/SUMMARY.md:53 src/basic-syntax/type-inference.md:1 msgid "Type Inference" msgstr "Inférence de type" -#: src/SUMMARY.md:45 +#: src/SUMMARY.md:54 msgid "static & const" msgstr "static & const" -#: src/SUMMARY.md:46 src/basic-syntax/scopes-shadowing.md:1 +#: src/SUMMARY.md:55 src/basic-syntax/scopes-shadowing.md:1 msgid "Scopes and Shadowing" msgstr "Portée et masquage" -#: src/SUMMARY.md:47 src/memory-management.md:1 -msgid "Memory Management" -msgstr "Gestion de la mémoire" - -#: src/SUMMARY.md:48 -msgid "Stack vs Heap" -msgstr "Pile et Tas" - -#: src/SUMMARY.md:49 src/memory-management/stack.md:1 -msgid "Stack Memory" -msgstr "Mémoire de pile" - -#: src/SUMMARY.md:50 src/memory-management/manual.md:1 -msgid "Manual Memory Management" -msgstr "Gestion manuelle de la mémoire" - -#: src/SUMMARY.md:51 src/memory-management/scope-based.md:1 -msgid "Scope-Based Memory Management" -msgstr "Gestion de la mémoire basée sur la portée" - -#: src/SUMMARY.md:52 -msgid "Garbage Collection" -msgstr "Collecte des ordures" - -#: src/SUMMARY.md:53 -msgid "Rust Memory Management" -msgstr "Gestion de la mémoire avec Rust" - -#: src/SUMMARY.md:54 src/memory-management/comparison.md:1 -msgid "Comparison" -msgstr "Comparaison" - -#: src/SUMMARY.md:55 src/ownership.md:1 -msgid "Ownership" -msgstr "Propriété" - -#: src/SUMMARY.md:56 src/ownership/move-semantics.md:1 -msgid "Move Semantics" -msgstr "Sémantique de déplacement" - -#: src/SUMMARY.md:57 src/ownership/moved-strings-rust.md:1 -msgid "Moved Strings in Rust" -msgstr "String déplacées avec Rust" - -#: src/SUMMARY.md:58 src/ownership/double-free-modern-cpp.md:1 -msgid "Double Frees in Modern C++" -msgstr "Double libération de mémoire en C++ moderne" - -#: src/SUMMARY.md:59 src/ownership/moves-function-calls.md:1 -msgid "Moves in Function Calls" -msgstr "Déplacements dans les appels de fonction" - -#: src/SUMMARY.md:60 src/ownership/copy-clone.md:1 -msgid "Copying and Cloning" -msgstr "Copie et clonage" - -#: src/SUMMARY.md:61 src/ownership/borrowing.md:1 -msgid "Borrowing" -msgstr "Emprunt" - -#: src/SUMMARY.md:62 src/ownership/shared-unique-borrows.md:1 -msgid "Shared and Unique Borrows" -msgstr "Emprunts partagés et uniques" - -#: src/SUMMARY.md:63 src/ownership/lifetimes.md:1 -msgid "Lifetimes" -msgstr "Durées de vie" - -#: src/SUMMARY.md:64 src/ownership/lifetimes-function-calls.md:1 -msgid "Lifetimes in Function Calls" -msgstr "Durées de vie dans les appels de fonction" - -#: src/SUMMARY.md:65 src/ownership/lifetimes-data-structures.md:1 -msgid "Lifetimes in Data Structures" -msgstr "Durées de vie dans les structures de données" - -#: src/SUMMARY.md:67 src/exercises/day-1/book-library.md:1 -#, fuzzy -msgid "Storing Books" -msgstr "String" - -#: src/SUMMARY.md:68 src/exercises/day-1/iterators-and-ownership.md:1 -msgid "Iterators and Ownership" -msgstr "Itérateurs et propriété" - -#: src/SUMMARY.md:71 -msgid "Day 2: Morning" -msgstr "Jour 2 : Matin" - -#: src/SUMMARY.md:76 src/structs.md:1 -msgid "Structs" -msgstr "Structures" - -#: src/SUMMARY.md:77 src/structs/tuple-structs.md:1 -msgid "Tuple Structs" -msgstr "Structures de tuple" - -#: src/SUMMARY.md:78 src/structs/field-shorthand.md:1 -msgid "Field Shorthand Syntax" -msgstr "Syntaxe abrégée des champs" - -#: src/SUMMARY.md:79 src/enums.md:1 +#: src/SUMMARY.md:56 src/enums.md:1 msgid "Enums" msgstr "Énumérations" -#: src/SUMMARY.md:80 src/enums/variant-payloads.md:1 +#: src/SUMMARY.md:57 src/enums/variant-payloads.md:1 msgid "Variant Payloads" msgstr "Contenu variable" -#: src/SUMMARY.md:81 src/enums/sizes.md:1 +#: src/SUMMARY.md:58 src/enums/sizes.md:1 msgid "Enum Sizes" msgstr "Tailles d'énumération" -#: src/SUMMARY.md:83 src/methods/receiver.md:1 +#: src/SUMMARY.md:60 src/control-flow/novel.md:1 +#, fuzzy +msgid "Novel Control Flow" +msgstr "Flux de contrôle" + +#: src/SUMMARY.md:61 +msgid "if let expressions" +msgstr "expressions `if let`" + +#: src/SUMMARY.md:62 +msgid "while let expressions" +msgstr "expressions `while let`" + +#: src/SUMMARY.md:63 +msgid "match expressions" +msgstr "expressions `match`" + +#: src/SUMMARY.md:65 src/pattern-matching.md:1 +msgid "Pattern Matching" +msgstr "Correspondance de motifs" + +#: src/SUMMARY.md:66 src/pattern-matching/destructuring-enums.md:1 +msgid "Destructuring Enums" +msgstr "Déstructuration des énumérations" + +#: src/SUMMARY.md:67 src/pattern-matching/destructuring-structs.md:1 +msgid "Destructuring Structs" +msgstr "Déstructuration des structures" + +#: src/SUMMARY.md:68 src/pattern-matching/destructuring-arrays.md:1 +msgid "Destructuring Arrays" +msgstr "Déstructuration des tableaux" + +#: src/SUMMARY.md:69 src/pattern-matching/match-guards.md:1 +msgid "Match Guards" +msgstr "Gardes de match" + +#: src/SUMMARY.md:72 src/exercises/day-1/luhn.md:1 +#: src/exercises/day-1/solutions-afternoon.md:3 +msgid "Luhn Algorithm" +msgstr "Algorithme de Luhn" + +#: src/SUMMARY.md:73 +#, fuzzy +msgid "Pattern Matching (TBD)" +msgstr "Correspondance de motifs" + +#: src/SUMMARY.md:75 +msgid "Day 2: Morning" +msgstr "Jour 2 : Matin" + +#: src/SUMMARY.md:81 src/memory-management.md:1 +msgid "Memory Management" +msgstr "Gestion de la mémoire" + +#: src/SUMMARY.md:82 +msgid "Stack vs Heap" +msgstr "Pile et Tas" + +#: src/SUMMARY.md:83 +msgid "Stack Memory" +msgstr "Mémoire de pile" + +#: src/SUMMARY.md:84 src/memory-management/manual.md:1 +msgid "Manual Memory Management" +msgstr "Gestion manuelle de la mémoire" + +#: src/SUMMARY.md:85 src/memory-management/scope-based.md:1 +msgid "Scope-Based Memory Management" +msgstr "Gestion de la mémoire basée sur la portée" + +#: src/SUMMARY.md:86 +msgid "Garbage Collection" +msgstr "Collecte des ordures" + +#: src/SUMMARY.md:87 +msgid "Rust Memory Management" +msgstr "Gestion de la mémoire avec Rust" + +#: src/SUMMARY.md:88 src/ownership.md:1 +msgid "Ownership" +msgstr "Propriété" + +#: src/SUMMARY.md:89 src/ownership/move-semantics.md:1 +msgid "Move Semantics" +msgstr "Sémantique de déplacement" + +#: src/SUMMARY.md:90 src/ownership/moved-strings-rust.md:1 +msgid "Moved Strings in Rust" +msgstr "String déplacées avec Rust" + +#: src/SUMMARY.md:91 +msgid "Double Frees in Modern C++" +msgstr "Double libération de mémoire en C++ moderne" + +#: src/SUMMARY.md:92 src/ownership/moves-function-calls.md:1 +msgid "Moves in Function Calls" +msgstr "Déplacements dans les appels de fonction" + +#: src/SUMMARY.md:93 src/ownership/copy-clone.md:1 +msgid "Copying and Cloning" +msgstr "Copie et clonage" + +#: src/SUMMARY.md:94 src/ownership/borrowing.md:1 +msgid "Borrowing" +msgstr "Emprunt" + +#: src/SUMMARY.md:95 src/ownership/shared-unique-borrows.md:1 +msgid "Shared and Unique Borrows" +msgstr "Emprunts partagés et uniques" + +#: src/SUMMARY.md:96 src/ownership/lifetimes.md:1 +msgid "Lifetimes" +msgstr "Durées de vie" + +#: src/SUMMARY.md:97 src/ownership/lifetimes-function-calls.md:1 +msgid "Lifetimes in Function Calls" +msgstr "Durées de vie dans les appels de fonction" + +#: src/SUMMARY.md:98 src/ownership/lifetimes-data-structures.md:1 +msgid "Lifetimes in Data Structures" +msgstr "Durées de vie dans les structures de données" + +#: src/SUMMARY.md:99 src/structs.md:1 +msgid "Structs" +msgstr "Structures" + +#: src/SUMMARY.md:100 src/structs/tuple-structs.md:1 +msgid "Tuple Structs" +msgstr "Structures de tuple" + +#: src/SUMMARY.md:101 src/structs/field-shorthand.md:1 +msgid "Field Shorthand Syntax" +msgstr "Syntaxe abrégée des champs" + +#: src/SUMMARY.md:103 src/methods/receiver.md:1 msgid "Method Receiver" msgstr "Récepteur de méthode" -#: src/SUMMARY.md:84 src/SUMMARY.md:159 src/SUMMARY.md:274 +#: src/SUMMARY.md:104 src/SUMMARY.md:166 src/SUMMARY.md:281 #: src/methods/example.md:1 src/concurrency/shared_state/example.md:1 msgid "Example" msgstr "Exemple" -#: src/SUMMARY.md:85 src/pattern-matching.md:1 -msgid "Pattern Matching" -msgstr "Correspondance de motifs" +#: src/SUMMARY.md:106 src/exercises/day-2/book-library.md:1 +#, fuzzy +msgid "Storing Books" +msgstr "String" -#: src/SUMMARY.md:86 src/pattern-matching/destructuring-enums.md:1 -msgid "Destructuring Enums" -msgstr "Déstructuration des énumérations" - -#: src/SUMMARY.md:87 src/pattern-matching/destructuring-structs.md:1 -msgid "Destructuring Structs" -msgstr "Déstructuration des structures" - -#: src/SUMMARY.md:88 src/pattern-matching/destructuring-arrays.md:1 -msgid "Destructuring Arrays" -msgstr "Déstructuration des tableaux" - -#: src/SUMMARY.md:89 src/pattern-matching/match-guards.md:1 -msgid "Match Guards" -msgstr "Gardes de match" - -#: src/SUMMARY.md:91 src/exercises/day-2/health-statistics.md:1 +#: src/SUMMARY.md:107 src/exercises/day-2/health-statistics.md:1 msgid "Health Statistics" msgstr "Statistiques de santé" -#: src/SUMMARY.md:92 src/exercises/day-2/solutions-morning.md:3 -msgid "Points and Polygons" -msgstr "Points et polygones" - -#: src/SUMMARY.md:94 +#: src/SUMMARY.md:109 msgid "Day 2: Afternoon" msgstr "Jour 2 : Après-midi" -#: src/SUMMARY.md:96 src/SUMMARY.md:288 src/control-flow.md:1 -msgid "Control Flow" -msgstr "Flux de contrôle" - -#: src/SUMMARY.md:97 src/control-flow/blocks.md:1 -msgid "Blocks" -msgstr "Blocs" - -#: src/SUMMARY.md:98 -msgid "if expressions" -msgstr "expressions `if`" - -#: src/SUMMARY.md:99 -msgid "if let expressions" -msgstr "expressions `if let`" - -#: src/SUMMARY.md:100 -msgid "while expressions" -msgstr "while expressions" - -#: src/SUMMARY.md:101 -msgid "while let expressions" -msgstr "expressions `while let`" - -#: src/SUMMARY.md:102 -msgid "for expressions" -msgstr "expressions `for`" - -#: src/SUMMARY.md:103 -msgid "loop expressions" -msgstr "expressions `loop`" - -#: src/SUMMARY.md:104 -msgid "match expressions" -msgstr "expressions `match`" - -#: src/SUMMARY.md:105 -msgid "break & continue" -msgstr "break & continue" - -#: src/SUMMARY.md:106 src/std.md:1 +#: src/SUMMARY.md:111 src/std.md:1 msgid "Standard Library" msgstr "Bibliothèque standard" -#: src/SUMMARY.md:107 +#: src/SUMMARY.md:112 msgid "Option and Result" msgstr "Option et Result" -#: src/SUMMARY.md:108 src/std/string.md:1 +#: src/SUMMARY.md:113 src/std/string.md:1 msgid "String" msgstr "String" -#: src/SUMMARY.md:109 +#: src/SUMMARY.md:114 msgid "Vec" msgstr "Vec" -#: src/SUMMARY.md:110 +#: src/SUMMARY.md:115 msgid "HashMap" msgstr "HashMap" -#: src/SUMMARY.md:111 +#: src/SUMMARY.md:116 msgid "Box" msgstr "Box" -#: src/SUMMARY.md:112 +#: src/SUMMARY.md:117 msgid "Recursive Data Types" msgstr "Types de données récursifs" -#: src/SUMMARY.md:113 src/std/box-niche.md:1 +#: src/SUMMARY.md:118 src/std/box-niche.md:1 msgid "Niche Optimization" msgstr "Optimisation de niche" -#: src/SUMMARY.md:114 +#: src/SUMMARY.md:119 msgid "Rc" msgstr "Rc" -#: src/SUMMARY.md:115 src/modules.md:1 +#: src/SUMMARY.md:120 +msgid "Cell/RefCell" +msgstr "" + +#: src/SUMMARY.md:121 src/modules.md:1 msgid "Modules" msgstr "Modules" -#: src/SUMMARY.md:116 src/modules/visibility.md:1 +#: src/SUMMARY.md:122 src/modules/visibility.md:1 msgid "Visibility" msgstr "Visibilité" -#: src/SUMMARY.md:117 src/modules/paths.md:1 +#: src/SUMMARY.md:123 src/modules/paths.md:1 msgid "Paths" msgstr "Chemins" -#: src/SUMMARY.md:118 src/modules/filesystem.md:1 +#: src/SUMMARY.md:124 src/modules/filesystem.md:1 msgid "Filesystem Hierarchy" msgstr "Hiérarchie du système de fichiers" -#: src/SUMMARY.md:120 src/exercises/day-2/luhn.md:1 -#: src/exercises/day-2/solutions-afternoon.md:3 -msgid "Luhn Algorithm" -msgstr "Algorithme de Luhn" +#: src/SUMMARY.md:126 src/exercises/day-2/iterators-and-ownership.md:1 +msgid "Iterators and Ownership" +msgstr "Itérateurs et propriété" -#: src/SUMMARY.md:121 src/exercises/day-2/strings-iterators.md:1 -#: src/exercises/day-2/solutions-afternoon.md:97 +#: src/SUMMARY.md:127 src/exercises/day-2/strings-iterators.md:1 +#: src/exercises/day-2/solutions-afternoon.md:3 msgid "Strings and Iterators" msgstr "Strings et Iterators" -#: src/SUMMARY.md:124 +#: src/SUMMARY.md:130 msgid "Day 3: Morning" msgstr "Jour 3 : Matin" -#: src/SUMMARY.md:129 src/generics.md:1 +#: src/SUMMARY.md:135 src/generics.md:1 msgid "Generics" msgstr "Génériques" -#: src/SUMMARY.md:130 src/generics/data-types.md:1 +#: src/SUMMARY.md:136 src/generics/data-types.md:1 msgid "Generic Data Types" msgstr "Types de données génériques" -#: src/SUMMARY.md:131 src/generics/methods.md:1 +#: src/SUMMARY.md:137 src/generics/methods.md:1 msgid "Generic Methods" msgstr "Méthodes génériques" -#: src/SUMMARY.md:132 src/generics/monomorphization.md:1 +#: src/SUMMARY.md:138 src/generics/monomorphization.md:1 msgid "Monomorphization" msgstr "Monomorphisation" -#: src/SUMMARY.md:133 src/traits.md:1 +#: src/SUMMARY.md:139 src/traits.md:1 msgid "Traits" msgstr "Caractéristiques" -#: src/SUMMARY.md:134 src/traits/trait-objects.md:1 +#: src/SUMMARY.md:140 src/traits/trait-objects.md:1 msgid "Trait Objects" msgstr "Objets implementant des caractéristiques" -#: src/SUMMARY.md:135 src/traits/deriving-traits.md:1 +#: src/SUMMARY.md:141 src/traits/deriving-traits.md:1 msgid "Deriving Traits" msgstr "Caractéristiques dérivées" -#: src/SUMMARY.md:136 src/traits/default-methods.md:1 +#: src/SUMMARY.md:142 src/traits/default-methods.md:1 msgid "Default Methods" msgstr "Méthodes par défaut" -#: src/SUMMARY.md:137 src/traits/trait-bounds.md:1 +#: src/SUMMARY.md:143 src/traits/trait-bounds.md:1 msgid "Trait Bounds" msgstr "Exigences de caractéristique" -#: src/SUMMARY.md:138 +#: src/SUMMARY.md:144 msgid "impl Trait" msgstr "impl caractéristique" -#: src/SUMMARY.md:139 src/traits/important-traits.md:1 +#: src/SUMMARY.md:145 src/traits/important-traits.md:1 msgid "Important Traits" msgstr "Caractéristiques importantes" -#: src/SUMMARY.md:140 +#: src/SUMMARY.md:146 msgid "Iterator" msgstr "Iterator" -#: src/SUMMARY.md:141 src/traits/from-iterator.md:1 +#: src/SUMMARY.md:147 src/traits/from-iterator.md:1 msgid "FromIterator" msgstr "FromIterator" -#: src/SUMMARY.md:142 +#: src/SUMMARY.md:148 msgid "From and Into" msgstr "From et Into" -#: src/SUMMARY.md:143 +#: src/SUMMARY.md:149 msgid "Read and Write" msgstr "Read et Write" -#: src/SUMMARY.md:144 +#: src/SUMMARY.md:150 msgid "Drop" msgstr "Drop" -#: src/SUMMARY.md:145 +#: src/SUMMARY.md:151 msgid "Default" msgstr "Default" -#: src/SUMMARY.md:146 +#: src/SUMMARY.md:152 msgid "Operators: Add, Mul, ..." msgstr "Opérateurs : Add, Mul, ..." -#: src/SUMMARY.md:147 +#: src/SUMMARY.md:153 msgid "Closures: Fn, FnMut, FnOnce" msgstr "" -#: src/SUMMARY.md:149 src/exercises/day-3/simple-gui.md:1 +#: src/SUMMARY.md:155 src/exercises/day-3/simple-gui.md:1 #: src/exercises/day-3/solutions-morning.md:3 msgid "A Simple GUI Library" msgstr "Une bibliothèque d'interface graphique" -#: src/SUMMARY.md:151 +#: src/SUMMARY.md:156 src/exercises/day-3/solutions-morning.md:175 +msgid "Points and Polygons" +msgstr "Points et polygones" + +#: src/SUMMARY.md:158 msgid "Day 3: Afternoon" msgstr "Jour 3 : Après-midi" -#: src/SUMMARY.md:153 src/error-handling.md:1 +#: src/SUMMARY.md:160 src/error-handling.md:1 msgid "Error Handling" msgstr "Gestion des erreurs" -#: src/SUMMARY.md:154 src/error-handling/panics.md:1 +#: src/SUMMARY.md:161 src/error-handling/panics.md:1 msgid "Panics" msgstr "Paniques" -#: src/SUMMARY.md:155 +#: src/SUMMARY.md:162 msgid "Catching Stack Unwinding" msgstr "Suspension de la pile" -#: src/SUMMARY.md:156 +#: src/SUMMARY.md:163 msgid "Structured Error Handling" msgstr "Gestion structurée des erreurs" -#: src/SUMMARY.md:157 +#: src/SUMMARY.md:164 msgid "Propagating Errors with ?" msgstr "Propagation des erreurs avec ?" -#: src/SUMMARY.md:158 src/error-handling/converting-error-types.md:1 +#: src/SUMMARY.md:165 src/error-handling/converting-error-types.md:1 #: src/error-handling/converting-error-types-example.md:1 msgid "Converting Error Types" msgstr "Conversion des types d'erreur" -#: src/SUMMARY.md:160 src/error-handling/deriving-error-enums.md:1 +#: src/SUMMARY.md:167 src/error-handling/deriving-error-enums.md:1 msgid "Deriving Error Enums" msgstr "Dérivation des énumérations d'erreur" -#: src/SUMMARY.md:161 src/error-handling/dynamic-errors.md:1 +#: src/SUMMARY.md:168 src/error-handling/dynamic-errors.md:1 msgid "Dynamic Error Types" msgstr "Types d'erreurs dynamiques" -#: src/SUMMARY.md:162 src/error-handling/error-contexts.md:1 +#: src/SUMMARY.md:169 src/error-handling/error-contexts.md:1 msgid "Adding Context to Errors" msgstr "Ajout de contexte aux erreurs" -#: src/SUMMARY.md:163 src/testing.md:1 +#: src/SUMMARY.md:170 src/testing.md:1 msgid "Testing" msgstr "Tester" -#: src/SUMMARY.md:164 src/testing/unit-tests.md:1 +#: src/SUMMARY.md:171 src/testing/unit-tests.md:1 msgid "Unit Tests" msgstr "Tests unitaires" -#: src/SUMMARY.md:165 src/testing/test-modules.md:1 +#: src/SUMMARY.md:172 src/testing/test-modules.md:1 msgid "Test Modules" msgstr "Modules de test" -#: src/SUMMARY.md:166 src/testing/doc-tests.md:1 +#: src/SUMMARY.md:173 src/testing/doc-tests.md:1 msgid "Documentation Tests" msgstr "Test de documentation" -#: src/SUMMARY.md:167 src/testing/integration-tests.md:1 +#: src/SUMMARY.md:174 src/testing/integration-tests.md:1 msgid "Integration Tests" msgstr "Test d'intégration" -#: src/SUMMARY.md:168 src/bare-metal/useful-crates.md:1 +#: src/SUMMARY.md:175 src/bare-metal/useful-crates.md:1 #, fuzzy msgid "Useful crates" msgstr "Caisses utiles" -#: src/SUMMARY.md:169 src/unsafe.md:1 +#: src/SUMMARY.md:176 src/unsafe.md:1 msgid "Unsafe Rust" msgstr "Rust risqué" -#: src/SUMMARY.md:170 src/unsafe/raw-pointers.md:1 +#: src/SUMMARY.md:177 src/unsafe/raw-pointers.md:1 msgid "Dereferencing Raw Pointers" msgstr "Déréférencement des pointeurs bruts" -#: src/SUMMARY.md:171 src/unsafe/mutable-static-variables.md:1 +#: src/SUMMARY.md:178 src/unsafe/mutable-static-variables.md:1 msgid "Mutable Static Variables" msgstr "Variables statiques mutables" -#: src/SUMMARY.md:172 src/unsafe/unions.md:1 +#: src/SUMMARY.md:179 src/unsafe/unions.md:1 msgid "Unions" msgstr "Unions" -#: src/SUMMARY.md:173 src/unsafe/calling-unsafe-functions.md:1 +#: src/SUMMARY.md:180 src/unsafe/calling-unsafe-functions.md:1 msgid "Calling Unsafe Functions" msgstr "Appel de fonctions risquées" -#: src/SUMMARY.md:174 src/unsafe/writing-unsafe-functions.md:1 +#: src/SUMMARY.md:181 src/unsafe/writing-unsafe-functions.md:1 msgid "Writing Unsafe Functions" msgstr "Ecrire des fonctions risquées" -#: src/SUMMARY.md:175 +#: src/SUMMARY.md:182 msgid "Extern Functions" msgstr "Fonctions externes" -#: src/SUMMARY.md:176 src/unsafe/unsafe-traits.md:1 +#: src/SUMMARY.md:183 src/unsafe/unsafe-traits.md:1 msgid "Implementing Unsafe Traits" msgstr "Implémentation de traits risqués" -#: src/SUMMARY.md:178 src/exercises/day-3/safe-ffi-wrapper.md:1 +#: src/SUMMARY.md:185 src/exercises/day-3/safe-ffi-wrapper.md:1 #: src/exercises/day-3/solutions-afternoon.md:3 msgid "Safe FFI Wrapper" msgstr "Enveloppe FFI sûre" -#: src/SUMMARY.md:181 src/SUMMARY.md:251 -#: src/running-the-course/course-structure.md:16 src/bare-metal/android.md:1 +#: src/SUMMARY.md:188 src/SUMMARY.md:258 src/bare-metal/android.md:1 msgid "Android" msgstr "Android" -#: src/SUMMARY.md:186 src/android/setup.md:1 +#: src/SUMMARY.md:193 src/android/setup.md:1 msgid "Setup" msgstr "Installation" -#: src/SUMMARY.md:187 src/android/build-rules.md:1 +#: src/SUMMARY.md:194 src/android/build-rules.md:1 msgid "Build Rules" msgstr "Règles de construction" -#: src/SUMMARY.md:188 +#: src/SUMMARY.md:195 msgid "Binary" msgstr "Binaire" -#: src/SUMMARY.md:189 +#: src/SUMMARY.md:196 msgid "Library" msgstr "Bibliothèque" -#: src/SUMMARY.md:190 src/android/aidl.md:1 +#: src/SUMMARY.md:197 src/android/aidl.md:1 msgid "AIDL" msgstr "AIDL" -#: src/SUMMARY.md:191 +#: src/SUMMARY.md:198 msgid "Interface" msgstr "Interface" -#: src/SUMMARY.md:192 +#: src/SUMMARY.md:199 msgid "Implementation" msgstr "Mise en œuvre" -#: src/SUMMARY.md:193 +#: src/SUMMARY.md:200 msgid "Server" msgstr "Serveur" -#: src/SUMMARY.md:194 src/android/aidl/deploy.md:1 +#: src/SUMMARY.md:201 src/android/aidl/deploy.md:1 msgid "Deploy" msgstr "Déployer" -#: src/SUMMARY.md:195 +#: src/SUMMARY.md:202 msgid "Client" msgstr "Client" -#: src/SUMMARY.md:196 src/android/aidl/changing.md:1 +#: src/SUMMARY.md:203 src/android/aidl/changing.md:1 msgid "Changing API" msgstr "Modification de l'API" -#: src/SUMMARY.md:197 src/SUMMARY.md:241 src/android/logging.md:1 +#: src/SUMMARY.md:204 src/SUMMARY.md:248 src/android/logging.md:1 #: src/bare-metal/aps/logging.md:1 msgid "Logging" msgstr "Journalisation" -#: src/SUMMARY.md:198 src/android/interoperability.md:1 +#: src/SUMMARY.md:205 src/android/interoperability.md:1 msgid "Interoperability" msgstr "Interopérabilité" -#: src/SUMMARY.md:199 +#: src/SUMMARY.md:206 msgid "With C" msgstr "Avec C" -#: src/SUMMARY.md:200 +#: src/SUMMARY.md:207 msgid "Calling C with Bindgen" msgstr "Appeler C avec Bindgen" -#: src/SUMMARY.md:201 +#: src/SUMMARY.md:208 msgid "Calling Rust from C" msgstr "Appeler Rust depuis C" -#: src/SUMMARY.md:202 src/android/interoperability/cpp.md:1 +#: src/SUMMARY.md:209 src/android/interoperability/cpp.md:1 msgid "With C++" msgstr "Avec C++" -#: src/SUMMARY.md:203 +#: src/SUMMARY.md:210 msgid "With Java" msgstr "Avec Java" -#: src/SUMMARY.md:207 +#: src/SUMMARY.md:214 msgid "Bare Metal: Morning" msgstr "Bare Metal : Matin" -#: src/SUMMARY.md:212 +#: src/SUMMARY.md:219 msgid "no_std" msgstr "no_std" -#: src/SUMMARY.md:213 +#: src/SUMMARY.md:220 msgid "A Minimal Example" msgstr "Un exemple minimal" -#: src/SUMMARY.md:214 +#: src/SUMMARY.md:221 msgid "alloc" msgstr "alloc" -#: src/SUMMARY.md:215 src/bare-metal/microcontrollers.md:1 +#: src/SUMMARY.md:222 src/bare-metal/microcontrollers.md:1 msgid "Microcontrollers" msgstr "Microcontrôleurs" -#: src/SUMMARY.md:216 src/bare-metal/microcontrollers/mmio.md:1 +#: src/SUMMARY.md:223 src/bare-metal/microcontrollers/mmio.md:1 msgid "Raw MMIO" msgstr "MMIO brut" -#: src/SUMMARY.md:217 +#: src/SUMMARY.md:224 msgid "PACs" msgstr "PACs" -#: src/SUMMARY.md:218 +#: src/SUMMARY.md:225 msgid "HAL Crates" msgstr "HAL Crates" -#: src/SUMMARY.md:219 +#: src/SUMMARY.md:226 msgid "Board Support Crates" msgstr "Board Support Crates" -#: src/SUMMARY.md:220 +#: src/SUMMARY.md:227 msgid "The Type State Pattern" msgstr "Le modèle d'état de type" -#: src/SUMMARY.md:221 +#: src/SUMMARY.md:228 msgid "embedded-hal" msgstr "embedded-hal" -#: src/SUMMARY.md:222 +#: src/SUMMARY.md:229 msgid "probe-rs, cargo-embed" msgstr "probe-rs, cargo-embed" -#: src/SUMMARY.md:223 src/bare-metal/microcontrollers/debugging.md:1 +#: src/SUMMARY.md:230 src/bare-metal/microcontrollers/debugging.md:1 msgid "Debugging" msgstr "Débogage" -#: src/SUMMARY.md:224 src/SUMMARY.md:244 +#: src/SUMMARY.md:231 src/SUMMARY.md:251 msgid "Other Projects" msgstr "Autres projets" -#: src/SUMMARY.md:226 src/exercises/bare-metal/compass.md:1 +#: src/SUMMARY.md:233 src/exercises/bare-metal/compass.md:1 #: src/exercises/bare-metal/solutions-morning.md:3 msgid "Compass" msgstr "Boussole" -#: src/SUMMARY.md:228 +#: src/SUMMARY.md:235 msgid "Bare Metal: Afternoon" msgstr "Bare Metal : Après-midi" -#: src/SUMMARY.md:230 +#: src/SUMMARY.md:237 msgid "Application Processors" msgstr "Processeurs d'applications" -#: src/SUMMARY.md:231 src/bare-metal/aps/entry-point.md:1 +#: src/SUMMARY.md:238 src/bare-metal/aps/entry-point.md:1 msgid "Getting Ready to Rust" msgstr "" -#: src/SUMMARY.md:232 +#: src/SUMMARY.md:239 msgid "Inline Assembly" msgstr "Assembleur en ligne" -#: src/SUMMARY.md:233 +#: src/SUMMARY.md:240 msgid "MMIO" msgstr "MMIO" -#: src/SUMMARY.md:234 +#: src/SUMMARY.md:241 msgid "Let's Write a UART Driver" msgstr "Écrivons un pilote UART" -#: src/SUMMARY.md:235 +#: src/SUMMARY.md:242 msgid "More Traits" msgstr "Plus de traits" -#: src/SUMMARY.md:236 +#: src/SUMMARY.md:243 msgid "A Better UART Driver" msgstr "Un meilleur pilote UART" -#: src/SUMMARY.md:237 src/bare-metal/aps/better-uart/bitflags.md:1 +#: src/SUMMARY.md:244 src/bare-metal/aps/better-uart/bitflags.md:1 msgid "Bitflags" msgstr "Bitflags" -#: src/SUMMARY.md:238 +#: src/SUMMARY.md:245 msgid "Multiple Registers" msgstr "Registres multiples" -#: src/SUMMARY.md:239 src/bare-metal/aps/better-uart/driver.md:1 +#: src/SUMMARY.md:246 src/bare-metal/aps/better-uart/driver.md:1 msgid "Driver" msgstr "Pilote" -#: src/SUMMARY.md:240 src/SUMMARY.md:242 +#: src/SUMMARY.md:247 src/SUMMARY.md:249 msgid "Using It" msgstr "En l'utilisant" -#: src/SUMMARY.md:243 src/bare-metal/aps/exceptions.md:1 +#: src/SUMMARY.md:250 src/bare-metal/aps/exceptions.md:1 #, fuzzy msgid "Exceptions" msgstr "Fonctions" -#: src/SUMMARY.md:245 +#: src/SUMMARY.md:252 msgid "Useful Crates" msgstr "Crates utiles" -#: src/SUMMARY.md:246 +#: src/SUMMARY.md:253 msgid "zerocopy" msgstr "zerocopy" -#: src/SUMMARY.md:247 +#: src/SUMMARY.md:254 msgid "aarch64-paging" msgstr "aarch64-paging" -#: src/SUMMARY.md:248 +#: src/SUMMARY.md:255 msgid "buddy_system_allocator" msgstr "buddy_system_allocator" -#: src/SUMMARY.md:249 +#: src/SUMMARY.md:256 msgid "tinyvec" msgstr "tinyvec" -#: src/SUMMARY.md:250 +#: src/SUMMARY.md:257 msgid "spin" msgstr "spin" -#: src/SUMMARY.md:252 src/bare-metal/android/vmbase.md:1 +#: src/SUMMARY.md:259 src/bare-metal/android/vmbase.md:1 msgid "vmbase" msgstr "vmbase" -#: src/SUMMARY.md:254 +#: src/SUMMARY.md:261 msgid "RTC Driver" msgstr "Pilote RTC" -#: src/SUMMARY.md:257 +#: src/SUMMARY.md:264 msgid "Concurrency: Morning" msgstr "Concurrence : Matin" -#: src/SUMMARY.md:262 src/concurrency/threads.md:1 +#: src/SUMMARY.md:269 src/concurrency/threads.md:1 msgid "Threads" msgstr "Threads" -#: src/SUMMARY.md:263 src/concurrency/scoped-threads.md:1 +#: src/SUMMARY.md:270 src/concurrency/scoped-threads.md:1 msgid "Scoped Threads" msgstr "Threads délimités" -#: src/SUMMARY.md:264 src/concurrency/channels.md:1 +#: src/SUMMARY.md:271 src/concurrency/channels.md:1 msgid "Channels" msgstr "Canaux" -#: src/SUMMARY.md:265 src/concurrency/channels/unbounded.md:1 +#: src/SUMMARY.md:272 src/concurrency/channels/unbounded.md:1 msgid "Unbounded Channels" msgstr "Canaux illimités" -#: src/SUMMARY.md:266 src/concurrency/channels/bounded.md:1 +#: src/SUMMARY.md:273 src/concurrency/channels/bounded.md:1 msgid "Bounded Channels" msgstr "Canaux limités" -#: src/SUMMARY.md:267 +#: src/SUMMARY.md:274 msgid "Send and Sync" msgstr "Send et Sync" -#: src/SUMMARY.md:267 +#: src/SUMMARY.md:274 msgid "Send" msgstr "Send" -#: src/SUMMARY.md:267 +#: src/SUMMARY.md:274 msgid "Sync" msgstr "Sync" -#: src/SUMMARY.md:270 src/concurrency/send-sync/examples.md:1 +#: src/SUMMARY.md:277 src/concurrency/send-sync/examples.md:1 msgid "Examples" msgstr "Exemples" -#: src/SUMMARY.md:271 src/concurrency/shared_state.md:1 +#: src/SUMMARY.md:278 src/concurrency/shared_state.md:1 msgid "Shared State" msgstr "État partagé" -#: src/SUMMARY.md:272 +#: src/SUMMARY.md:279 msgid "Arc" msgstr "Arc" -#: src/SUMMARY.md:273 +#: src/SUMMARY.md:280 msgid "Mutex" msgstr "Mutex" -#: src/SUMMARY.md:276 src/SUMMARY.md:297 +#: src/SUMMARY.md:283 src/SUMMARY.md:304 #: src/exercises/concurrency/dining-philosophers.md:1 #: src/exercises/concurrency/solutions-morning.md:3 msgid "Dining Philosophers" msgstr "Dîner des philosophes" -#: src/SUMMARY.md:277 src/exercises/concurrency/link-checker.md:1 +#: src/SUMMARY.md:284 src/exercises/concurrency/link-checker.md:1 msgid "Multi-threaded Link Checker" msgstr "Vérificateur de liens à plusieurs threads" -#: src/SUMMARY.md:279 +#: src/SUMMARY.md:286 #, fuzzy msgid "Concurrency: Afternoon" msgstr "Concurrence : Après-midi" -#: src/SUMMARY.md:281 +#: src/SUMMARY.md:288 msgid "Async Basics" msgstr "" -#: src/SUMMARY.md:282 +#: src/SUMMARY.md:289 msgid "async/await" msgstr "" -#: src/SUMMARY.md:283 src/async/futures.md:1 +#: src/SUMMARY.md:290 src/async/futures.md:1 #, fuzzy msgid "Futures" msgstr "Fermetures" -#: src/SUMMARY.md:284 src/async/runtimes.md:1 +#: src/SUMMARY.md:291 src/async/runtimes.md:1 #, fuzzy msgid "Runtimes" msgstr "Garanties d'exécution" -#: src/SUMMARY.md:285 src/async/runtimes/tokio.md:1 +#: src/SUMMARY.md:292 src/async/runtimes/tokio.md:1 msgid "Tokio" msgstr "" -#: src/SUMMARY.md:286 src/exercises/concurrency/link-checker.md:106 -#: src/exercises/concurrency/chat-app.md:140 src/async/tasks.md:1 +#: src/SUMMARY.md:293 src/exercises/concurrency/link-checker.md:126 +#: src/async/tasks.md:1 src/exercises/concurrency/chat-app.md:140 msgid "Tasks" msgstr "Tâches" -#: src/SUMMARY.md:287 src/async/channels.md:1 +#: src/SUMMARY.md:294 src/async/channels.md:1 msgid "Async Channels" msgstr "Canaux asynchrones" -#: src/SUMMARY.md:289 src/async/control-flow/join.md:1 +#: src/SUMMARY.md:296 src/async/control-flow/join.md:1 msgid "Join" msgstr "" -#: src/SUMMARY.md:290 src/async/control-flow/select.md:1 +#: src/SUMMARY.md:297 src/async/control-flow/select.md:1 #, fuzzy msgid "Select" msgstr "Installation" -#: src/SUMMARY.md:291 +#: src/SUMMARY.md:298 msgid "Pitfalls" msgstr "Pièges" -#: src/SUMMARY.md:292 +#: src/SUMMARY.md:299 msgid "Blocking the Executor" msgstr "" -#: src/SUMMARY.md:293 src/async/pitfalls/pin.md:1 +#: src/SUMMARY.md:300 src/async/pitfalls/pin.md:1 msgid "Pin" msgstr "" -#: src/SUMMARY.md:294 src/async/pitfalls/async-traits.md:1 +#: src/SUMMARY.md:301 src/async/pitfalls/async-traits.md:1 #, fuzzy msgid "Async Traits" msgstr "Traits asynchrones" -#: src/SUMMARY.md:295 src/async/pitfalls/cancellation.md:1 +#: src/SUMMARY.md:302 src/async/pitfalls/cancellation.md:1 #, fuzzy msgid "Cancellation" msgstr "Traductions" -#: src/SUMMARY.md:298 src/exercises/concurrency/chat-app.md:1 -#: src/exercises/concurrency/solutions-afternoon.md:113 +#: src/SUMMARY.md:305 src/exercises/concurrency/chat-app.md:1 +#: src/exercises/concurrency/solutions-afternoon.md:119 msgid "Broadcast Chat Application" msgstr "" -#: src/SUMMARY.md:301 +#: src/SUMMARY.md:308 msgid "Final Words" msgstr "Derniers mots" -#: src/SUMMARY.md:305 src/thanks.md:1 +#: src/SUMMARY.md:312 src/thanks.md:1 msgid "Thanks!" msgstr "Merci!" -#: src/SUMMARY.md:306 +#: src/SUMMARY.md:313 msgid "Other Resources" msgstr "Autres ressources" -#: src/SUMMARY.md:307 src/credits.md:1 +#: src/SUMMARY.md:314 src/credits.md:1 msgid "Credits" msgstr "Crédits" -#: src/SUMMARY.md:310 src/exercises/solutions.md:1 +#: src/SUMMARY.md:317 src/exercises/solutions.md:1 msgid "Solutions" msgstr "Solutions" -#: src/SUMMARY.md:315 +#: src/SUMMARY.md:322 msgid "Day 1 Morning" msgstr "Jour 1 Matin" -#: src/SUMMARY.md:316 +#: src/SUMMARY.md:323 msgid "Day 1 Afternoon" msgstr "Jour 1 Après-midi" -#: src/SUMMARY.md:317 +#: src/SUMMARY.md:324 msgid "Day 2 Morning" msgstr "Jour 2 Matin" -#: src/SUMMARY.md:318 +#: src/SUMMARY.md:325 msgid "Day 2 Afternoon" msgstr "Jour 2 Après-midi" -#: src/SUMMARY.md:319 +#: src/SUMMARY.md:326 msgid "Day 3 Morning" msgstr "Jour 3 Matin" -#: src/SUMMARY.md:320 +#: src/SUMMARY.md:327 msgid "Day 3 Afternoon" msgstr "Jour 3 Après-midi" -#: src/SUMMARY.md:321 +#: src/SUMMARY.md:328 msgid "Bare Metal Rust Morning" msgstr "Bare Metal Rust Matin" -#: src/SUMMARY.md:322 src/exercises/bare-metal/solutions-afternoon.md:1 +#: src/SUMMARY.md:329 src/exercises/bare-metal/solutions-afternoon.md:1 msgid "Bare Metal Rust Afternoon" msgstr "Bare Metal Rust Après-midi" -#: src/SUMMARY.md:323 +#: src/SUMMARY.md:330 msgid "Concurrency Morning" msgstr "Matin concurrence" -#: src/SUMMARY.md:324 +#: src/SUMMARY.md:331 msgid "Concurrency Afternoon" msgstr "Après-midi concurrence" -#: src/welcome.md:3 -msgid "" -"[![Build workflow](https://img.shields.io/github/actions/workflow/status/" -"google/comprehensive-rust/build.yml?style=flat-square)](https://github.com/" -"google/comprehensive-rust/actions/workflows/build.yml?query=branch%3Amain)" -msgstr "" -"[![Flux de construction](https://img.shields.io/github/actions/workflow/" -"status/google/comprehensive-rust/build.yml?style=flat-square)](https://" -"github.com/google/comprehensive-rust/actions/workflows/build.yml?" -"query=branch%3Amain)" - -#: src/welcome.md:3 -msgid "Build workflow" -msgstr "Flux de construction" - -#: src/welcome.md:3 +#: src/index.md:3 +#, fuzzy msgid "" "[![Build workflow](https://img.shields.io/github/actions/workflow/status/" "google/comprehensive-rust/build.yml?style=flat-square)](https://github.com/" "google/comprehensive-rust/actions/workflows/build.yml?query=branch%3Amain) [!" "[GitHub contributors](https://img.shields.io/github/contributors/google/" "comprehensive-rust?style=flat-square)](https://github.com/google/" -"comprehensive-rust/graphs/contributors)" +"comprehensive-rust/graphs/contributors) [![GitHub stars](https://img.shields." +"io/github/stars/google/comprehensive-rust?style=flat-square)](https://github." +"com/google/comprehensive-rust/stargazers)" msgstr "" "[![Flux de construction](https://img.shields.io/github/actions/workflow/" "status/google/comprehensive-rust/build.yml?style=flat-square)](https://" @@ -1061,51 +1058,26 @@ msgstr "" "contributors/google/comprehensive-rust?style=flat-square)](https://github." "com/google/comprehensive-rust/graphs/contributors)" -#: src/welcome.md:4 -msgid "GitHub contributors" -msgstr "Contributeurs GitHub" - -#: src/welcome.md:4 +#: src/index.md:7 +#, fuzzy msgid "" -"[![GitHub contributors](https://img.shields.io/github/contributors/google/" -"comprehensive-rust?style=flat-square)](https://github.com/google/" -"comprehensive-rust/graphs/contributors) [![GitHub stars](https://img.shields." -"io/github/stars/google/comprehensive-rust?style=flat-square)](https://github." -"com/google/comprehensive-rust/stargazers)" -msgstr "" -"[![Contributeurs GitHub](https://img.shields.io/github/contributors/google/" -"comprehensive-rust?style=flat-square)](https://github.com/google/" -"comprehensive-rust/graphs/contributors) [![GitHub étoiles](https://img." -"shields.io/github/stars/google/comprehensive-rust?style=flat-square)]" -"(https://github.com/google/comprehensive-rust/stargazers)" - -#: src/welcome.md:5 -msgid "GitHub stars" -msgstr "Étoiles GitHub" - -#: src/welcome.md:5 -msgid "" -"[![GitHub stars](https://img.shields.io/github/stars/google/comprehensive-" -"rust?style=flat-square)](https://github.com/google/comprehensive-rust/" -"stargazers)" -msgstr "" -"[![GitHub étoiles](https://img.shields.io/github/stars/google/comprehensive-" -"rust?style=flat-square)](https://github.com/google/comprehensive-rust/" -"stargazers)" - -#: src/welcome.md:7 -msgid "" -"This is a three day Rust course developed by the Android team. The course " -"covers the full spectrum of Rust, from basic syntax to advanced topics like " -"generics and error handling. It also includes Android-specific content on " -"the last day." +"This is a free Rust course developed by the Android team at Google. The " +"course covers the full spectrum of Rust, from basic syntax to advanced " +"topics like generics and error handling." msgstr "" "Ce cours Rust de trois jours a été développé par l'équipe Android. Le cours " "couvre l'ensemble du langage Rust, de la syntaxe de base aux sujets avancés " "comme les génériques et la gestion des erreurs. Il inclut également du " "contenu spécifique à Android le dernier jour." -#: src/welcome.md:11 +#: src/index.md:11 +msgid "" +"The latest version of the course can be found at . If you are reading somewhere else, please check there " +"for updates." +msgstr "" + +#: src/index.md:15 msgid "" "The goal of the course is to teach you Rust. We assume you don't know " "anything about Rust and hope to:" @@ -1113,30 +1085,34 @@ msgstr "" "Le but du cours est de vous apprendre Rust. Nous supposons que vous ne savez " "rien à propos de Rust et espérons :" -#: src/welcome.md:14 +#: src/index.md:18 msgid "Give you a comprehensive understanding of the Rust syntax and language." msgstr "" "Vous donner une compréhension complète de la syntaxe et du langage Rust." -#: src/welcome.md:15 +#: src/index.md:19 msgid "Enable you to modify existing programs and write new programs in Rust." msgstr "" "Vous permettre de modifier des programmes existants et d'écrire de nouveaux " "programmes en Rust." -#: src/welcome.md:16 +#: src/index.md:20 msgid "Show you common Rust idioms." msgstr "Vous montrer les constructions fréquentes (idiomes) en Rust." -#: src/welcome.md:18 +#: src/index.md:22 +msgid "We call the first three course days Rust Fundamentals." +msgstr "" + +#: src/index.md:24 +#, fuzzy msgid "" -"The first three days show you the fundamentals of Rust. Following this, " -"you're invited to dive into one or more specialized topics:" +"Building on this, you're invited to dive into one or more specialized topics:" msgstr "" "Les trois premiers jours sont consacrés aux fondamentaux du langage. Vous " "pouvez ensuite approfondir un ou plusieurs des sujets suivant:" -#: src/welcome.md:21 +#: src/index.md:26 msgid "" "[Android](android.md): a half-day course on using Rust for Android platform " "development (AOSP). This includes interoperability with C, C++, and Java." @@ -1145,7 +1121,7 @@ msgstr "" "de Rust dans le cadre du développement pour la plate-forme Android. Ce cours " "couvre également l'interopérabilité avec les langages C, C++ et Java." -#: src/welcome.md:23 +#: src/index.md:28 msgid "" "[Bare-metal](bare-metal.md): a whole-day class on using Rust for bare-metal " "(embedded) development. Both microcontrollers and application processors are " @@ -1155,7 +1131,7 @@ msgstr "" "de Rust pour le développement embarqué. Le cours touche à la fois aux " "microcontrôleurs et aux processeurs d'applications." -#: src/welcome.md:26 +#: src/index.md:31 msgid "" "[Concurrency](concurrency.md): a whole-day class on concurrency in Rust. We " "cover both classical concurrency (preemptively scheduling using threads and " @@ -1167,11 +1143,11 @@ msgstr "" "classique (planification à base de threads et mutex) ainsi que la " "concurrence async/await (multitâche coopératif à base de futures)." -#: src/welcome.md:32 +#: src/index.md:37 msgid "Non-Goals" msgstr "Non-objectifs" -#: src/welcome.md:34 +#: src/index.md:39 msgid "" "Rust is a large language and we won't be able to cover all of it in a few " "days. Some non-goals of this course are:" @@ -1179,7 +1155,7 @@ msgstr "" "Rust est un grand langage et nous ne pourrons pas tout couvrir en quelques " "jours. Certains non-objectifs de ce cours sont :" -#: src/welcome.md:37 +#: src/index.md:42 #, fuzzy msgid "" "Learning how to develop macros: please see [Chapter 19.5 in the Rust Book]" @@ -1191,22 +1167,22 @@ msgstr "" "lang.org/book/ch19-01-unsafe-rust.html) et le [Rustonomicon](https://doc." "rust-lang.org/nomicon/)." -#: src/welcome.md:41 +#: src/index.md:46 msgid "Assumptions" msgstr "Hypothèses" -#: src/welcome.md:43 +#: src/index.md:48 #, fuzzy msgid "" "The course assumes that you already know how to program. Rust is a " -"statically- typed language and we will sometimes make comparisons with C and " +"statically-typed language and we will sometimes make comparisons with C and " "C++ to better explain or contrast the Rust approach." msgstr "" "Le cours suppose que vous savez déjà programmer. Rust est un language " "statiquement typé et on fera parfois des comparaisons avec C et C++ pour " "mieux expliquer ou contraster l'approche de Rust." -#: src/welcome.md:47 +#: src/index.md:52 #, fuzzy msgid "" "If you know how to program in a dynamically-typed language such as Python or " @@ -1215,7 +1191,7 @@ msgstr "" "Si vous savez programmer dans un langage à typage dynamique tel que Python " "ou JavaScript, alors vous pourrez également très bien suivre." -#: src/welcome.md:52 +#: src/index.md:57 msgid "" "This is an example of a _speaker note_. We will use these to add additional " "information to the slides. This could be key points which the instructor " @@ -1239,10 +1215,20 @@ msgstr "" "le cours en interne chez Google." #: src/running-the-course.md:8 +msgid "" +"We typically run classes from 10:00 am to 4:00 pm, with a 1 hour lunch break " +"in the middle. This leaves 2.5 hours for the morning class and 2.5 hours for " +"the afternoon class. Note that this is just a recommendation: you can also " +"spend 3 hour on the morning session to give people more time for exercises. " +"The downside of longer session is that people can become very tired after 6 " +"full hours of class in the afternoon." +msgstr "" + +#: src/running-the-course.md:16 msgid "Before you run the course, you will want to:" msgstr "Avant de suivre le cours, vous voudriez :" -#: src/running-the-course.md:10 +#: src/running-the-course.md:18 #, fuzzy msgid "" "Make yourself familiar with the course material. We've included speaker " @@ -1258,7 +1244,7 @@ msgstr "" "sur le lien avec une petite flèche à côté de \"Notes du conférencier\"). " "Ainsi, vous avez un écran propre à présenter à la classe." -#: src/running-the-course.md:16 +#: src/running-the-course.md:24 #, fuzzy msgid "" "Decide on the dates. Since the course takes at least three full days, we " @@ -1269,7 +1255,7 @@ msgstr "" "Sélectionnez votre sujet pour l'après-midi du quatrième jour. Cela peut être " "basé sur le public que vous attendez, ou sur votre propre expertise." -#: src/running-the-course.md:21 +#: src/running-the-course.md:29 #, fuzzy msgid "" "Find a room large enough for your in-person participants. We recommend a " @@ -1285,7 +1271,7 @@ msgstr "" "dit qu'ils trouvent utile d'avoir une pause dans le cours, car cela les aide " "à traiter toutes les informations que nous leur donnons." -#: src/running-the-course.md:29 +#: src/running-the-course.md:37 #, fuzzy msgid "" "On the day of your course, show up to the room a little early to set things " @@ -1304,7 +1290,7 @@ msgstr "" "portables. En particulier, vous ferez beaucoup de programmation en direct en " "tant qu'instructeur, donc un pupitre ne sera pas très utile pour vous." -#: src/running-the-course.md:35 +#: src/running-the-course.md:43 #, fuzzy msgid "" "Let people solve the exercises by themselves or in small groups. We " @@ -1333,7 +1319,7 @@ msgstr "" "\n" "Préparez tout ce dont vous avez besoin pour l'après-midi du jour 4." -#: src/running-the-course.md:43 +#: src/running-the-course.md:51 msgid "" "That is all, good luck running the course! We hope it will be as much fun " "for you as it has been for us!" @@ -1341,7 +1327,7 @@ msgstr "" "C'est tout, bonne chance pour suivre le cours ! Nous espérons que ce sera " "aussi amusant pour vous comme il l'a été pour nous !" -#: src/running-the-course.md:46 +#: src/running-the-course.md:54 msgid "" "Please [provide feedback](https://github.com/google/comprehensive-rust/" "discussions/86) afterwards so that we can keep improving the course. We " @@ -1357,48 +1343,65 @@ msgstr "" "discussions/100) !" #: src/running-the-course/course-structure.md:5 -msgid "The course is fast paced and covers a lot of ground:" -msgstr "Le cours est rapide et couvre beaucoup de terrain:" +#, fuzzy +msgid "Rust Fundamentals" +msgstr "Binaires de rouille" #: src/running-the-course/course-structure.md:7 -#, fuzzy -msgid "Day 1: Basic Rust, ownership and the borrow checker." -msgstr "Jour 1 : Rust de base, propriété et vérificateur d'emprunt." +msgid "" +"The first three days make up [Rust Fundaments](../welcome-day-1.md). The " +"days are fast paced and we cover a lot of ground:" +msgstr "" -#: src/running-the-course/course-structure.md:8 +#: src/running-the-course/course-structure.md:10 +msgid "Day 1: Basic Rust, syntax, control flow, creating and consuming values." +msgstr "" + +#: src/running-the-course/course-structure.md:11 #, fuzzy -msgid "Day 2: Compound data types, pattern matching, the standard library." +msgid "" +"Day 2: Memory management, ownership, compound data types, and the standard " +"library." msgstr "" "Jour 2 : Types de données composés, filtrage de motifs, bibliothèque " "standard." -#: src/running-the-course/course-structure.md:9 +#: src/running-the-course/course-structure.md:12 #, fuzzy -msgid "Day 3: Traits and generics, error handling, testing, unsafe Rust." +msgid "Day 3: Generics, traits, error handling, testing, and unsafe Rust." msgstr "" "Jour 3 : Caractéristiques et génériques, gestion des erreurs, tests, Rust " "risqué.\n" "\n" "Jour 4 : Concurrence avec Rust et voir Rust en action." -#: src/running-the-course/course-structure.md:11 +#: src/running-the-course/course-structure.md:14 msgid "Deep Dives" msgstr "" -#: src/running-the-course/course-structure.md:13 +#: src/running-the-course/course-structure.md:16 msgid "" "In addition to the 3-day class on Rust Fundamentals, we cover some more " "specialized topics:" msgstr "" -#: src/running-the-course/course-structure.md:18 -msgid "" -"The [Android Deep Dive](../android.md) is a half-day course on using Rust " -"for Android platform development. This includes interoperability with C, C+" -"+, and Java." -msgstr "" +#: src/running-the-course/course-structure.md:19 +#, fuzzy +msgid "Rust in Android" +msgstr "Bienvenue au jour 1" -#: src/running-the-course/course-structure.md:22 +#: src/running-the-course/course-structure.md:21 +#, fuzzy +msgid "" +"The [Rust in Android](../android.md) deep dive is a half-day course on using " +"Rust for Android platform development. This includes interoperability with " +"C, C++, and Java." +msgstr "" +"[Android](android.md): un cours d'une demi-journée consacré à l'utilisation " +"de Rust dans le cadre du développement pour la plate-forme Android. Ce cours " +"couvre également l'interopérabilité avec les langages C, C++ et Java." + +#: src/running-the-course/course-structure.md:25 #, fuzzy msgid "" "You will need an [AOSP checkout](https://source.android.com/docs/setup/" @@ -1415,7 +1418,7 @@ msgstr "" "système de construction d'Android voit les fichiers `Android.bp` dans `src/" "android/`." -#: src/running-the-course/course-structure.md:27 +#: src/running-the-course/course-structure.md:30 #, fuzzy msgid "" "Ensure that `adb sync` works with your emulator or real device and pre-build " @@ -1427,18 +1430,23 @@ msgstr "" "android/build_all.sh`. Lisez le script pour voir les commandes éxécutées et " "assurez-vous qu'elles fonctionnent lorsque vous les exécutez à la main." -#: src/running-the-course/course-structure.md:34 -msgid "Bare-Metal" -msgstr "" +#: src/running-the-course/course-structure.md:37 +#, fuzzy +msgid "Bare-Metal Rust" +msgstr "Bare Metal Rust Matin" -#: src/running-the-course/course-structure.md:36 +#: src/running-the-course/course-structure.md:39 +#, fuzzy msgid "" -"The [Bare-Metal Deep Dive](../bare-metal.md): a full day class on using Rust " -"for bare-metal (embedded) development. Both microcontrollers and application " -"processors are covered." +"The [Bare-Metal Rust](../bare-metal.md) deep dive is a full day class on " +"using Rust for bare-metal (embedded) development. Both microcontrollers and " +"application processors are covered." msgstr "" +"[Bare-metal](bare-metal.md): un cours d'une journée consacré à l'utilisation " +"de Rust pour le développement embarqué. Le cours touche à la fois aux " +"microcontrôleurs et aux processeurs d'applications." -#: src/running-the-course/course-structure.md:40 +#: src/running-the-course/course-structure.md:43 msgid "" "For the microcontroller part, you will need to buy the [BBC micro:bit]" "(https://microbit.org/) v2 development board ahead of time. Everybody will " @@ -1446,25 +1454,25 @@ msgid "" "bare-metal.md)." msgstr "" -#: src/running-the-course/course-structure.md:45 +#: src/running-the-course/course-structure.md:48 #, fuzzy -msgid "Concurrency" -msgstr "Concurrence" - -#: src/running-the-course/course-structure.md:47 -msgid "" -"The [Concurrency Deep Dive](../concurrency.md) is a full day class on " -"classical as well as `async`/`await` concurrency." -msgstr "" +msgid "Concurrency in Rust" +msgstr "Bienvenue à Comprehensive Rust(le guide complet de Rust) 🦀" #: src/running-the-course/course-structure.md:50 msgid "" +"The [Concurrency in Rust](../concurrency.md) deep dive is a full day class " +"on classical as well as `async`/`await` concurrency." +msgstr "" + +#: src/running-the-course/course-structure.md:53 +msgid "" "You will need a fresh crate set up and the dependencies downloaded and ready " "to go. You can then copy/paste the examples into `src/main.rs` to experiment " "with them:" msgstr "" -#: src/running-the-course/course-structure.md:54 +#: src/running-the-course/course-structure.md:57 msgid "" "```shell\n" "cargo init concurrency\n" @@ -1474,11 +1482,11 @@ msgid "" "```" msgstr "" -#: src/running-the-course/course-structure.md:61 +#: src/running-the-course/course-structure.md:64 msgid "Format" msgstr "\\##Format" -#: src/running-the-course/course-structure.md:63 +#: src/running-the-course/course-structure.md:66 msgid "" "The course is meant to be very interactive and we recommend letting the " "questions drive the exploration of Rust!" @@ -1531,10 +1539,12 @@ msgstr "" "bénévoles:" #: src/running-the-course/translations.md:6 +#, fuzzy msgid "" "[Brazilian Portuguese](https://google.github.io/comprehensive-rust/pt-BR/) " -"by [@rastringer](https://github.com/rastringer) and [@hugojacob](https://" -"github.com/hugojacob)." +"by [@rastringer](https://github.com/rastringer), [@hugojacob](https://github." +"com/hugojacob), [@joaovicmendes](https://github.com/joaovicmendes) and " +"[@henrif75](https://github.com/henrif75)." msgstr "" "[portugais brésilien](https://google.github.io/comprehensive-rust/pt-BR/) " "par [@rastringer](https://github.com/rastringer) et [@hugojacob](https://" @@ -1623,63 +1633,50 @@ msgid "Installation" msgstr "Installation" #: src/cargo.md:10 -msgid "Rustup (Recommended)" -msgstr "Rustup (recommandé)" +msgid "**Please follow the instructions on .**" +msgstr "" #: src/cargo.md:12 +#, fuzzy msgid "" -"You can follow the instructions to install cargo and rust compiler, among " -"other standard ecosystem tools with the [rustup](https://rust-analyzer." -"github.io/) tool, which is maintained by the Rust Foundation." -msgstr "" -"Vous pouvez suivre les instructions pour installer Cargo et le compilateur " -"Rust, parmi d'autres outils de l'écosystème standard avec l'outil [rustup]" -"(https://rust-analyzer.github.io/), qui est maintenu par la Foundation Rust." - -#: src/cargo.md:14 -msgid "" -"Along with cargo and rustc, Rustup will install itself as a command line " -"utility that you can use to install/switch toolchains, setup cross " -"compilation, etc." +"This will give you the Cargo build tool (`cargo`) and the Rust compiler " +"(`rustc`). You will also get `rustup`, a command line utility that you can " +"use to install/switch toolchains, setup cross compilation, etc." msgstr "" "Avec cargo et rustc, Rustup s'installera en tant qu'utilitaire de ligne de " "commande que vous pourrez utiliser pour installer/changer de chaînes " "d'outils, configurer une compilation croisée, etc." #: src/cargo.md:16 -msgid "Package Managers" -msgstr "\\### Gestionnaires de packages" - -#: src/cargo.md:18 -msgid "Debian" -msgstr "Debian" - -#: src/cargo.md:20 +#, fuzzy msgid "" -"On Debian/Ubuntu, you can install Cargo, the Rust source and the [Rust " -"formatter](https://github.com/rust-lang/rustfmt) with" +"On Debian/Ubuntu, you can also install Cargo, the Rust source and the [Rust " +"formatter](https://github.com/rust-lang/rustfmt) via `apt`. However, this " +"gets you an outdated rust version and may lead to unexpected behavior. The " +"command would be:" msgstr "" "Sur Debian/Ubuntu, vous pouvez installer Cargo, la source Rust et le " "[formateur Rust](https://github.com/rust-lang/rustfmt) avec" -#: src/cargo.md:22 +#: src/cargo.md:18 msgid "" "```shell\n" -"$ sudo apt install cargo rust-src rustfmt\n" +"sudo apt install cargo rust-src rustfmt\n" "```" msgstr "" -#: src/cargo.md:26 +#: src/cargo.md:22 +#, fuzzy msgid "" -"This will allow \\[rust-analyzer\\]\\[1\\] to jump to the definitions. We " -"suggest using [VS Code](https://code.visualstudio.com/) to edit the code " -"(but any LSP compatible editor works)." +"We suggest using [VS Code](https://code.visualstudio.com/) to edit the code " +"(but any LSP compatible editor works with rust-analyzer[3](https://rust-" +"analyzer.github.io/))." msgstr "" "Cela permettra à \\[rust-analyzer\\]\\[1\\] de passer directement aux " "définitions. Nous suggérons d'utiliser [VS Code](https://code.visualstudio." "com/) pour modifier le code (mais tout éditeur LSP compatible fonctionne)." -#: src/cargo.md:29 +#: src/cargo.md:24 msgid "" "Some folks also like to use the [JetBrains](https://www.jetbrains.com/" "clion/) family of IDEs, which do their own analysis but have their own " @@ -1714,11 +1711,12 @@ msgstr "" "et autres formats intermédiaires." #: src/cargo/rust-ecosystem.md:8 +#, fuzzy msgid "" "`cargo`: the Rust dependency manager and build tool. Cargo knows how to " -"download dependencies hosted on and it will pass them to " -"`rustc` when building your project. Cargo also comes with a built-in test " -"runner which is used to execute unit tests." +"download dependencies, usually hosted on , and it will " +"pass them to `rustc` when building your project. Cargo also comes with a " +"built-in test runner which is used to execute unit tests." msgstr "" "`cargo` : le gestionnaire de dépendances Rust et l'outil de construction. " "Cargo sait comment télécharger les dépendances hébergées sur i32 {\n" +" x + x\n" +"}\n" +"\n" +"fn main() {\n" +" println!(\"doubled: {}\", double(7));\n" +"}\n" +"```" +msgstr "" + +#: src/control-flow/blocks.md:43 src/enums.md:34 src/enums/sizes.md:28 +#: src/pattern-matching.md:25 src/pattern-matching/match-guards.md:22 +#: src/structs.md:31 src/methods.md:30 src/methods/example.md:46 +#, fuzzy +msgid "Key Points:" +msgstr "Points clés:" + +#: src/control-flow/blocks.md:44 +#, fuzzy +msgid "" +"The point of this slide is to show that blocks have a type and value in " +"Rust. " +msgstr "" +"Le but de cette diapositive est de montrer que les blocs ont un type et une " +"valeur dans Rust." + +#: src/control-flow/blocks.md:45 +#, fuzzy +msgid "" +"You can show how the value of the block changes by changing the last line in " +"the block. For instance, adding/removing a semicolon or using a `return`." +msgstr "" +"Vous pouvez montrer comment la valeur du bloc change en modifiant la " +"dernière ligne du bloc. Par exemple, ajouter/supprimer un point-virgule ou " +"utiliser un \"retour\"." + +#: src/control-flow/if-expressions.md:1 +#, fuzzy +msgid "`if` expressions" +msgstr "expressions \"si\"" + +#: src/control-flow/if-expressions.md:3 +msgid "" +"You use [`if` expressions](https://doc.rust-lang.org/reference/expressions/" +"if-expr.html#if-expressions) exactly like `if` statements in other languages:" +msgstr "" + +#: src/control-flow/if-expressions.md:7 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let mut x = 10;\n" +" if x % 2 == 0 {\n" +" x = x / 2;\n" +" } else {\n" +" x = 3 * x + 1;\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/control-flow/if-expressions.md:18 +#, fuzzy +msgid "" +"In addition, you can use `if` as an expression. The last expression of each " +"block becomes the value of the `if` expression:" +msgstr "" +"De plus, vous pouvez l'utiliser comme expression. Cela fait la même chose " +"que ci-dessus:" + +#: src/control-flow/if-expressions.md:22 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let mut x = 10;\n" +" x = if x % 2 == 0 {\n" +" x / 2\n" +" } else {\n" +" 3 * x + 1\n" +" };\n" +"}\n" +"```" +msgstr "" + +#: src/control-flow/if-expressions.md:35 +msgid "" +"Because `if` is an expression and must have a particular type, both of its " +"branch blocks must have the same type. Consider showing what happens if you " +"add `;` after `x / 2` in the second example." +msgstr "" + +#: src/control-flow/for-expressions.md:1 +#, fuzzy +msgid "`for` loops" +msgstr "Boucles `for`" + +#: src/control-flow/for-expressions.md:3 +#, fuzzy +msgid "" +"The [`for` loop](https://doc.rust-lang.org/std/keyword.for.html) is closely " +"related to the [`while let` loop](while-let-expressions.md). It will " +"automatically call `into_iter()` on the expression and then iterate over it:" +msgstr "" +"L'expression `for` est étroitement liée à l'expression `while let`. Ce sera " +"appelez automatiquement `into_iter()` sur l'expression, puis parcourez-la :" + +#: src/control-flow/for-expressions.md:7 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let v = vec![10, 20, 30];\n" +"\n" +" for x in v {\n" +" println!(\"x: {x}\");\n" +" }\n" +" \n" +" for i in (0..10).step_by(2) {\n" +" println!(\"i: {i}\");\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/control-flow/for-expressions.md:21 +#, fuzzy +msgid "You can use `break` and `continue` here as usual." +msgstr "Vous pouvez utiliser `break` et `continue` ici comme d'habitude." + +#: src/control-flow/for-expressions.md:25 +#, fuzzy +msgid "Index iteration is not a special syntax in Rust for just that case." +msgstr "" +"L'itération d'index n'est pas une syntaxe spéciale dans Rust pour ce cas " +"précis." + +#: src/control-flow/for-expressions.md:26 +#, fuzzy +msgid "`(0..10)` is a range that implements an `Iterator` trait. " +msgstr "`(0..10)` est une plage qui implémente un trait `Iterator`." + +#: src/control-flow/for-expressions.md:27 +#, fuzzy +msgid "" +"`step_by` is a method that returns another `Iterator` that skips every other " +"element. " +msgstr "" +"`step_by` est une méthode qui renvoie un autre `Iterator` qui saute tous les " +"autres éléments." + +#: src/control-flow/for-expressions.md:28 +#, fuzzy +msgid "" +"Modify the elements in the vector and explain the compiler errors. Change " +"vector `v` to be mutable and the for loop to `for x in v.iter_mut()`." +msgstr "" +"Modifier les éléments du vecteur et expliquer les erreurs du compilateur. " +"Modifiez le vecteur `v` pour qu'il soit modifiable et la boucle for en `for " +"x in v.iter_mut()`." + +#: src/control-flow/while-expressions.md:1 +#, fuzzy +msgid "`while` loops" +msgstr "Expressions `while`" + +#: src/control-flow/while-expressions.md:3 +msgid "" +"The [`while` keyword](https://doc.rust-lang.org/reference/expressions/loop-" +"expr.html#predicate-loops) works very similar to other languages:" +msgstr "" + +#: src/control-flow/while-expressions.md:6 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let mut x = 10;\n" +" while x != 1 {\n" +" x = if x % 2 == 0 {\n" +" x / 2\n" +" } else {\n" +" 3 * x + 1\n" +" };\n" +" }\n" +" println!(\"Final x: {x}\");\n" +"}\n" +"```" +msgstr "" + +#: src/control-flow/break-continue.md:1 +#, fuzzy +msgid "`break` and `continue`" +msgstr "`pause` et `continue`" + +#: src/control-flow/break-continue.md:3 +msgid "" +"If you want to exit a loop early, use [`break`](https://doc.rust-lang.org/" +"reference/expressions/loop-expr.html#break-expressions)," +msgstr "" + +#: src/control-flow/break-continue.md:4 +msgid "" +"If you want to immediately start the next iteration use [`continue`](https://" +"doc.rust-lang.org/reference/expressions/loop-expr.html#continue-expressions)." +msgstr "" + +#: src/control-flow/break-continue.md:7 +#, fuzzy +msgid "" +"Both `continue` and `break` can optionally take a label argument which is " +"used to break out of nested loops:" +msgstr "" +"Si vous voulez quitter une boucle plus tôt, utilisez `break`, si vous voulez " +"commencer immédiatement la prochaine itération utilise `continue`. " +"`continue` et `break` peuvent éventuellement prenez un argument d'étiquette " +"qui est utilisé pour sortir des boucles imbriquées :" + +#: src/control-flow/break-continue.md:10 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let v = vec![10, 20, 30];\n" +" let mut iter = v.into_iter();\n" +" 'outer: while let Some(x) = iter.next() {\n" +" println!(\"x: {x}\");\n" +" let mut i = 0;\n" +" while i < x {\n" +" println!(\"x: {x}, i: {i}\");\n" +" i += 1;\n" +" if i == 3 {\n" +" break 'outer;\n" +" }\n" +" }\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/control-flow/break-continue.md:28 +#, fuzzy +msgid "" +"In this case we break the outer loop after 3 iterations of the inner loop." +msgstr "" +"Dans ce cas, nous cassons la boucle externe après 3 itérations de la boucle " +"interne." + +#: src/control-flow/loop-expressions.md:1 +#, fuzzy +msgid "`loop` expressions" +msgstr "\\# expressions de \"boucle\"" + +#: src/control-flow/loop-expressions.md:3 +msgid "" +"Finally, there is a [`loop` keyword](https://doc.rust-lang.org/reference/" +"expressions/loop-expr.html#infinite-loops) which creates an endless loop." +msgstr "" + +#: src/control-flow/loop-expressions.md:6 +#, fuzzy +msgid "Here you must either `break` or `return` to stop the loop:" +msgstr "" +"Enfin, il existe un mot-clé `loop` qui crée une boucle sans fin. Ici, vous " +"devez soit `break` ou `return` pour arrêter la boucle :" + +#: src/control-flow/loop-expressions.md:8 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let mut x = 10;\n" +" loop {\n" +" x = if x % 2 == 0 {\n" +" x / 2\n" +" } else {\n" +" 3 * x + 1\n" +" };\n" +" if x == 1 {\n" +" break;\n" +" }\n" +" }\n" +" println!(\"Final x: {x}\");\n" +"}\n" +"```" +msgstr "" + +#: src/control-flow/loop-expressions.md:27 +msgid "Break the `loop` with a value (e.g. `break 8`) and print it out." +msgstr "" + +#: src/control-flow/loop-expressions.md:28 +msgid "" +"Note that `loop` is the only looping construct which returns a non-trivial " +"value. This is because it's guaranteed to be entered at least once (unlike " +"`while` and `for` loops)." +msgstr "" + #: src/basic-syntax/variables.md:3 #, fuzzy msgid "" @@ -4097,15 +4520,6 @@ msgstr "" "progressivement les types de moins en moins au fur et à mesure que le cours " "avance." -#: src/basic-syntax/variables.md:18 -#, fuzzy -msgid "" -"Note that since `println!` is a macro, `x` is not moved, even using the " -"function like syntax of `println!(\"x: {}\", x)`" -msgstr "" -"Notez que puisque `println!` est une macro, `x` n'est pas déplacé, même en " -"utilisant la fonction comme syntaxe de `println!(\"x: {}\", x)`" - #: src/basic-syntax/type-inference.md:3 #, fuzzy msgid "Rust will look at how the variable is _used_ to determine the type:" @@ -4189,8 +4603,10 @@ msgstr "" #, fuzzy msgid "" "[`collect`](https://doc.rust-lang.org/stable/std/iter/trait.Iterator." -"html#method.collect) relies on `FromIterator`, which [`HashSet`](https://doc." -"rust-lang.org/std/iter/trait.FromIterator.html) implements." +"html#method.collect) relies on [`FromIterator`](https://doc.rust-lang.org/" +"std/iter/trait.FromIterator.html), which [`HashSet`](https://doc.rust-lang." +"org/std/collections/struct.HashSet.html#impl-FromIterator%3CT%3E-for-" +"HashSet%3CT,+S%3E) implements." msgstr "" "[`collect`](https://doc.rust-lang.org/stable/std/iter/trait.Iterator." "html#method.collect) repose sur `FromIterator`, qui \\[`HashSet`\\](https:/ /" @@ -4202,21 +4618,24 @@ msgid "Static and Constant Variables" msgstr "Variables statiques et constantes" #: src/basic-syntax/static-and-const.md:3 -#, fuzzy -msgid "Global state is managed with static and constant variables." -msgstr "L'état global est géré avec des variables statiques et constantes." +msgid "" +"Static and constant variables are two different ways to create globally-" +"scoped values that cannot be moved or reallocated during the execution of " +"the program. " +msgstr "" -#: src/basic-syntax/static-and-const.md:5 +#: src/basic-syntax/static-and-const.md:6 #, fuzzy msgid "`const`" msgstr "`const`" -#: src/basic-syntax/static-and-const.md:7 -#, fuzzy -msgid "You can declare compile-time constants:" -msgstr "Vous pouvez déclarer des constantes de compilation :" +#: src/basic-syntax/static-and-const.md:8 +msgid "" +"Constant variables are evaluated at compile time and their values are " +"inlined wherever they are used:" +msgstr "" -#: src/basic-syntax/static-and-const.md:9 +#: src/basic-syntax/static-and-const.md:11 msgid "" "```rust,editable\n" "const DIGEST_SIZE: usize = 3;\n" @@ -4238,7 +4657,7 @@ msgid "" "```" msgstr "" -#: src/basic-syntax/static-and-const.md:27 +#: src/basic-syntax/static-and-const.md:29 #, fuzzy msgid "" "According to the [Rust RFC Book](https://rust-lang.github.io/rfcs/0246-const-" @@ -4247,17 +4666,24 @@ msgstr "" "Selon le \\[Rust RFC Book\\] [1](https://rust-lang.github.io/rfcs/0246-const-" "vs-static.html), ceux-ci sont intégrés lors de l'utilisation." -#: src/basic-syntax/static-and-const.md:29 +#: src/basic-syntax/static-and-const.md:31 +msgid "" +"Only functions marked `const` can be called at compile time to generate " +"`const` values. `const` functions can however be called at runtime." +msgstr "" + +#: src/basic-syntax/static-and-const.md:33 #, fuzzy msgid "`static`" msgstr "`statique`" -#: src/basic-syntax/static-and-const.md:31 -#, fuzzy -msgid "You can also declare static variables:" -msgstr "Vous pouvez également déclarer des variables statiques :" +#: src/basic-syntax/static-and-const.md:35 +msgid "" +"Static variables will live during the whole execution of the program, and " +"therefore will not move:" +msgstr "" -#: src/basic-syntax/static-and-const.md:33 +#: src/basic-syntax/static-and-const.md:37 msgid "" "```rust,editable\n" "static BANNER: &str = \"Welcome to RustOS 3.14\";\n" @@ -4268,13 +4694,15 @@ msgid "" "```" msgstr "" -#: src/basic-syntax/static-and-const.md:41 +#: src/basic-syntax/static-and-const.md:45 #, fuzzy msgid "" "As noted in the [Rust RFC Book](https://rust-lang.github.io/rfcs/0246-const-" "vs-static.html), these are not inlined upon use and have an actual " -"associated memory location. This is useful for unsafe and embedded code, " -"and the variable lives through the entirety of the program execution." +"associated memory location. This is useful for unsafe and embedded code, " +"and the variable lives through the entirety of the program execution. When a " +"globally-scoped value does not have a reason to need object identity, " +"`const` is generally preferred." msgstr "" "Comme indiqué dans le \\[Rust RFC Book\\] [1](https://rust-lang.github.io/" "rfcs/0246-const-vs-static.html), ceux-ci ne sont pas alignés lors de " @@ -4282,23 +4710,24 @@ msgstr "" "pour le code non sécurisé et intégré, et la variable vit tout au long de " "l'exécution du programme." -#: src/basic-syntax/static-and-const.md:44 -#, fuzzy +#: src/basic-syntax/static-and-const.md:49 msgid "" -"We will look at mutating static data in the [chapter on Unsafe Rust](../" -"unsafe.md)." +"Because `static` variables are accessible from any thread, they must be " +"`Sync`. Interior mutability is possible through a [`Mutex`](https://doc.rust-" +"lang.org/std/sync/struct.Mutex.html), atomic or similar. It is also possible " +"to have mutable statics, but they require manual synchronisation so any " +"access to them requires `unsafe` code. We will look at [mutable statics](../" +"unsafe/mutable-static-variables.md) in the chapter on Unsafe Rust." msgstr "" -"Nous examinerons la mutation des données statiques dans le [chapitre sur " -"Unsafe Rust](../unsafe.md)." -#: src/basic-syntax/static-and-const.md:48 +#: src/basic-syntax/static-and-const.md:57 #, fuzzy msgid "Mention that `const` behaves semantically similar to C++'s `constexpr`." msgstr "" "Mentionnez que `const` se comporte sémantiquement de la même manière que " "`constexpr` de C++." -#: src/basic-syntax/static-and-const.md:49 +#: src/basic-syntax/static-and-const.md:58 #, fuzzy msgid "" "`static`, on the other hand, is much more similar to a `const` or mutable " @@ -4307,7 +4736,13 @@ msgstr "" "`static`, d'autre part, ressemble beaucoup plus à une variable globale " "`const` ou mutable en C++." -#: src/basic-syntax/static-and-const.md:50 +#: src/basic-syntax/static-and-const.md:59 +msgid "" +"`static` provides object identity: an address in memory and state as " +"required by types with interior mutability such as `Mutex`." +msgstr "" + +#: src/basic-syntax/static-and-const.md:60 #, fuzzy msgid "" "It isn't super common that one would need a runtime evaluated constant, but " @@ -4316,6 +4751,74 @@ msgstr "" "Il n'est pas très courant d'avoir besoin d'une constante évaluée à " "l'exécution, mais c'est utile et plus sûr que d'utiliser un statique." +#: src/basic-syntax/static-and-const.md:61 +msgid "`thread_local` data can be created with the macro `std::thread_local`." +msgstr "" + +#: src/basic-syntax/static-and-const.md:63 +msgid "Properties table:" +msgstr "" + +#: src/basic-syntax/static-and-const.md:65 +msgid "Property" +msgstr "" + +#: src/basic-syntax/static-and-const.md:65 +#, fuzzy +msgid "Static" +msgstr "`statique`" + +#: src/basic-syntax/static-and-const.md:65 +msgid "Constant" +msgstr "" + +#: src/basic-syntax/static-and-const.md:67 +msgid "Has an address in memory" +msgstr "" + +#: src/basic-syntax/static-and-const.md:67 +#: src/basic-syntax/static-and-const.md:68 +#: src/basic-syntax/static-and-const.md:70 +#: src/basic-syntax/static-and-const.md:71 +msgid "Yes" +msgstr "" + +#: src/basic-syntax/static-and-const.md:67 +msgid "No (inlined)" +msgstr "" + +#: src/basic-syntax/static-and-const.md:68 +#, fuzzy +msgid "Lives for the entire duration of the program" +msgstr "La fonction `main` est le point d'entrée du programme." + +#: src/basic-syntax/static-and-const.md:68 +#: src/basic-syntax/static-and-const.md:69 +#: src/basic-syntax/static-and-const.md:71 +msgid "No" +msgstr "" + +#: src/basic-syntax/static-and-const.md:69 +msgid "Can be mutable" +msgstr "" + +#: src/basic-syntax/static-and-const.md:69 +msgid "Yes (unsafe)" +msgstr "" + +#: src/basic-syntax/static-and-const.md:70 +#, fuzzy +msgid "Evaluated at compile time" +msgstr "Les valeurs ont des tailles fixes connues au moment de la compilation." + +#: src/basic-syntax/static-and-const.md:70 +msgid "Yes (initialised at compile time)" +msgstr "" + +#: src/basic-syntax/static-and-const.md:71 +msgid "Inlined wherever it is used" +msgstr "" + #: src/basic-syntax/scopes-shadowing.md:3 #, fuzzy msgid "" @@ -4394,2070 +4897,6 @@ msgid "" "```" msgstr "" -#: src/memory-management.md:3 -#, fuzzy -msgid "Traditionally, languages have fallen into two broad categories:" -msgstr "" -"Traditionnellement, les langues se répartissent en deux grandes catégories :" - -#: src/memory-management.md:5 -#, fuzzy -msgid "Full control via manual memory management: C, C++, Pascal, ..." -msgstr "" -"Contrôle total via la gestion manuelle de la mémoire : C, C++, Pascal, ..." - -#: src/memory-management.md:6 -#, fuzzy -msgid "" -"Full safety via automatic memory management at runtime: Java, Python, Go, " -"Haskell, ..." -msgstr "" -"Sécurité totale via la gestion automatique de la mémoire à l'exécution : " -"Java, Python, Go, Haskell, ..." - -#: src/memory-management.md:8 -#, fuzzy -msgid "Rust offers a new mix:" -msgstr "Rust propose un nouveau mix :" - -#: src/memory-management.md:10 -#, fuzzy -msgid "" -"Full control _and_ safety via compile time enforcement of correct memory " -"management." -msgstr "" -"Contrôle total * et * sécurité via l'application du temps de compilation de " -"la mémoire correcte gestion." - -#: src/memory-management.md:13 -#, fuzzy -msgid "It does this with an explicit ownership concept." -msgstr "Il le fait avec un concept de propriété explicite." - -#: src/memory-management.md:15 -#, fuzzy -msgid "First, let's refresh how memory management works." -msgstr "" -"Tout d'abord, rafraîchissons le fonctionnement de la gestion de la mémoire." - -#: src/memory-management/stack-vs-heap.md:1 -#, fuzzy -msgid "The Stack vs The Heap" -msgstr "La pile contre le tas" - -#: src/memory-management/stack-vs-heap.md:3 -#, fuzzy -msgid "Stack: Continuous area of memory for local variables." -msgstr "Pile : Zone continue de mémoire pour les variables locales." - -#: src/memory-management/stack-vs-heap.md:4 -#, fuzzy -msgid "Values have fixed sizes known at compile time." -msgstr "Les valeurs ont des tailles fixes connues au moment de la compilation." - -#: src/memory-management/stack-vs-heap.md:5 -#, fuzzy -msgid "Extremely fast: just move a stack pointer." -msgstr "Extrêmement rapide : il suffit de déplacer un pointeur de pile." - -#: src/memory-management/stack-vs-heap.md:6 -#, fuzzy -msgid "Easy to manage: follows function calls." -msgstr "Facile à gérer : suit les appels de fonction." - -#: src/memory-management/stack-vs-heap.md:7 -#, fuzzy -msgid "Great memory locality." -msgstr "Grande localité de mémoire." - -#: src/memory-management/stack-vs-heap.md:9 -#, fuzzy -msgid "Heap: Storage of values outside of function calls." -msgstr "Heap : Stockage de valeurs en dehors des appels de fonction." - -#: src/memory-management/stack-vs-heap.md:10 -#, fuzzy -msgid "Values have dynamic sizes determined at runtime." -msgstr "" -"Les valeurs ont des tailles dynamiques déterminées au moment de l'exécution." - -#: src/memory-management/stack-vs-heap.md:11 -#, fuzzy -msgid "Slightly slower than the stack: some book-keeping needed." -msgstr "" -"Légèrement plus lent que la pile : une certaine comptabilité est nécessaire." - -#: src/memory-management/stack-vs-heap.md:12 -#, fuzzy -msgid "No guarantee of memory locality." -msgstr "Aucune garantie de localisation de la mémoire." - -#: src/memory-management/stack.md:3 -#, fuzzy -msgid "" -"Creating a `String` puts fixed-sized data on the stack and dynamically sized " -"data on the heap:" -msgstr "" -"La création d'une \"chaîne\" place des données de taille fixe sur la pile et " -"dimensionnées dynamiquement données sur le tas :" - -#: src/memory-management/stack.md:6 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let s1 = String::from(\"Hello\");\n" -"}\n" -"```" -msgstr "" - -#: src/memory-management/stack.md:12 -msgid "" -"```bob\n" -" Stack Heap\n" -".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - -.\n" -": : : :\n" -": s1 : : :\n" -": +-----------+-------+ : : +----+----+----+----+----+ :\n" -": | ptr | o---+---+-----+-->| H | e | l | l | o | :\n" -": | len | 5 | : : +----+----+----+----+----+ :\n" -": | capacity | 5 | : : :\n" -": +-----------+-------+ : : :\n" -": : `- - - - - - - - - - - - - - - -'\n" -"`- - - - - - - - - - - - - -'\n" -"```" -msgstr "" - -#: src/memory-management/stack.md:28 -msgid "" -"Mention that a `String` is backed by a `Vec`, so it has a capacity and " -"length and can grow if mutable via reallocation on the heap." -msgstr "" - -#: src/memory-management/stack.md:30 -msgid "" -"If students ask about it, you can mention that the underlying memory is heap " -"allocated using the [System Allocator](https://doc.rust-lang.org/std/alloc/" -"struct.System.html) and custom allocators can be implemented using the " -"[Allocator API](https://doc.rust-lang.org/std/alloc/index.html)" -msgstr "" - -#: src/memory-management/stack.md:32 -msgid "" -"We can inspect the memory layout with `unsafe` code. However, you should " -"point out that this is rightfully unsafe!" -msgstr "" - -#: src/memory-management/stack.md:34 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let mut s1 = String::from(\"Hello\");\n" -" s1.push(' ');\n" -" s1.push_str(\"world\");\n" -" // DON'T DO THIS AT HOME! For educational purposes only.\n" -" // String provides no guarantees about its layout, so this could lead " -"to\n" -" // undefined behavior.\n" -" unsafe {\n" -" let (capacity, ptr, len): (usize, usize, usize) = std::mem::" -"transmute(s1);\n" -" println!(\"ptr = {ptr:#x}, len = {len}, capacity = {capacity}\");\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/memory-management/manual.md:3 -#, fuzzy -msgid "You allocate and deallocate heap memory yourself." -msgstr "Vous allouez et désallouez vous-même la mémoire de tas." - -#: src/memory-management/manual.md:5 -#, fuzzy -msgid "" -"If not done with care, this can lead to crashes, bugs, security " -"vulnerabilities, and memory leaks." -msgstr "" -"Si cela n'est pas fait avec soin, cela peut entraîner des plantages, des " -"bogues, des failles de sécurité et des fuites de mémoire." - -#: src/memory-management/manual.md:7 -#, fuzzy -msgid "C Example" -msgstr "C Exemple" - -#: src/memory-management/manual.md:9 -#, fuzzy -msgid "You must call `free` on every pointer you allocate with `malloc`:" -msgstr "" -"Vous devez appeler `free` sur chaque pointeur que vous allouez avec " -"`malloc` :" - -#: src/memory-management/manual.md:11 -msgid "" -"```c\n" -"void foo(size_t n) {\n" -" int* int_array = malloc(n * sizeof(int));\n" -" //\n" -" // ... lots of code\n" -" //\n" -" free(int_array);\n" -"}\n" -"```" -msgstr "" - -#: src/memory-management/manual.md:21 -#, fuzzy -msgid "" -"Memory is leaked if the function returns early between `malloc` and `free`: " -"the pointer is lost and we cannot deallocate the memory." -msgstr "" -"La mémoire est perdue si la fonction revient tôt entre `malloc` et `free` : " -"le pointeur est perdu et nous ne pouvons pas désallouer la mémoire." - -#: src/memory-management/scope-based.md:3 -#, fuzzy -msgid "" -"Constructors and destructors let you hook into the lifetime of an object." -msgstr "" -"Les constructeurs et les destructeurs vous permettent de vous connecter à la " -"durée de vie d'un objet." - -#: src/memory-management/scope-based.md:5 -#, fuzzy -msgid "" -"By wrapping a pointer in an object, you can free memory when the object is " -"destroyed. The compiler guarantees that this happens, even if an exception " -"is raised." -msgstr "" -"En enveloppant un pointeur dans un objet, vous pouvez libérer de la mémoire " -"lorsque l'objet est détruit. Le compilateur garantit que cela se produit, " -"même si une exception est soulevé." - -#: src/memory-management/scope-based.md:9 -#, fuzzy -msgid "" -"This is often called _resource acquisition is initialization_ (RAII) and " -"gives you smart pointers." -msgstr "" -"Ceci est souvent appelé _l'acquisition de ressources est initialisée_ (RAII) " -"et donne vous pointeurs intelligents." - -#: src/memory-management/scope-based.md:12 -#, fuzzy -msgid "C++ Example" -msgstr "Exemple C++" - -#: src/memory-management/scope-based.md:14 -msgid "" -"```c++\n" -"void say_hello(std::unique_ptr person) {\n" -" std::cout << \"Hello \" << person->name << std::endl;\n" -"}\n" -"```" -msgstr "" - -#: src/memory-management/scope-based.md:20 -#, fuzzy -msgid "" -"The `std::unique_ptr` object is allocated on the stack, and points to memory " -"allocated on the heap." -msgstr "" -"L'objet `std::unique_ptr` est alloué sur la pile et pointe vers mémoire " -"allouée sur le tas." - -#: src/memory-management/scope-based.md:22 -#, fuzzy -msgid "At the end of `say_hello`, the `std::unique_ptr` destructor will run." -msgstr "À la fin de `say_hello`, le destructeur `std::unique_ptr` s'exécutera." - -#: src/memory-management/scope-based.md:23 -#, fuzzy -msgid "The destructor frees the `Person` object it points to." -msgstr "Le destructeur libère l'objet `Person` vers lequel il pointe." - -#: src/memory-management/scope-based.md:25 -#, fuzzy -msgid "" -"Special move constructors are used when passing ownership to a function:" -msgstr "" -"Des constructeurs de mouvement spéciaux sont utilisés lors du transfert de " -"propriété à une fonction :" - -#: src/memory-management/scope-based.md:27 -msgid "" -"```c++\n" -"std::unique_ptr person = find_person(\"Carla\");\n" -"say_hello(std::move(person));\n" -"```" -msgstr "" - -#: src/memory-management/garbage-collection.md:1 -#, fuzzy -msgid "Automatic Memory Management" -msgstr "Gestion automatique de la mémoire" - -#: src/memory-management/garbage-collection.md:3 -#, fuzzy -msgid "" -"An alternative to manual and scope-based memory management is automatic " -"memory management:" -msgstr "" -"Une alternative à la gestion manuelle et basée sur la portée de la mémoire " -"est la mémoire automatique gestion:" - -#: src/memory-management/garbage-collection.md:6 -#, fuzzy -msgid "The programmer never allocates or deallocates memory explicitly." -msgstr "Le programmeur n'alloue ou ne libère jamais de mémoire explicitement." - -#: src/memory-management/garbage-collection.md:7 -#, fuzzy -msgid "" -"A garbage collector finds unused memory and deallocates it for the " -"programmer." -msgstr "" -"Un ramasse-miettes trouve la mémoire inutilisée et la libère pour le " -"programmeur." - -#: src/memory-management/garbage-collection.md:9 -#, fuzzy -msgid "Java Example" -msgstr "Exemple Java" - -#: src/memory-management/garbage-collection.md:11 -#, fuzzy -msgid "The `person` object is not deallocated after `sayHello` returns:" -msgstr "L'objet `person` n'est pas désalloué après le retour de `sayHello` :" - -#: src/memory-management/garbage-collection.md:13 -msgid "" -"```java\n" -"void sayHello(Person person) {\n" -" System.out.println(\"Hello \" + person.getName());\n" -"}\n" -"```" -msgstr "" - -#: src/memory-management/rust.md:1 -#, fuzzy -msgid "Memory Management in Rust" -msgstr "Gestion de la mémoire avec Rust" - -#: src/memory-management/rust.md:3 -#, fuzzy -msgid "Memory management in Rust is a mix:" -msgstr "La gestion de la mémoire avec Rust est un mélange :" - -#: src/memory-management/rust.md:5 -#, fuzzy -msgid "Safe and correct like Java, but without a garbage collector." -msgstr "Sûr et correct comme Java, mais sans ramasse-miettes." - -#: src/memory-management/rust.md:6 -#, fuzzy -msgid "" -"Depending on which abstraction (or combination of abstractions) you choose, " -"can be a single unique pointer, reference counted, or atomically reference " -"counted." -msgstr "" -"Selon l'abstraction (ou la combinaison d'abstractions) que vous choisissez, " -"il peut s'agir d'un seul pointeur unique, d'une référence comptée ou d'une " -"référence atomique comptée." - -#: src/memory-management/rust.md:7 -#, fuzzy -msgid "Scope-based like C++, but the compiler enforces full adherence." -msgstr "" -"Basé sur la portée comme C++, mais le compilateur applique une adhésion " -"totale." - -#: src/memory-management/rust.md:8 -#, fuzzy -msgid "" -"A Rust user can choose the right abstraction for the situation, some even " -"have no cost at runtime like C." -msgstr "" -"Un utilisateur de Rust peut choisir la bonne abstraction pour la situation, " -"certains n'ont même aucun coût à l'exécution comme C." - -#: src/memory-management/rust.md:10 -#, fuzzy -msgid "Rust achieves this by modeling _ownership_ explicitly." -msgstr "Il y parvient en modélisant explicitement _ownership_." - -#: src/memory-management/rust.md:14 -#, fuzzy -msgid "" -"If asked how at this point, you can mention that in Rust this is usually " -"handled by RAII wrapper types such as [Box](https://doc.rust-lang.org/std/" -"boxed/struct.Box.html), [Vec](https://doc.rust-lang.org/std/vec/struct.Vec." -"html), [Rc](https://doc.rust-lang.org/std/rc/struct.Rc.html), or [Arc]" -"(https://doc.rust-lang.org/std/sync/struct.Arc.html). These encapsulate " -"ownership and memory allocation via various means, and prevent the potential " -"errors in C." -msgstr "" -"Si on vous demande comment à ce stade, vous pouvez mentionner qu'avec Rust, " -"cela est généralement géré par des types de wrapper RAII tels que [Box]" -"(https://doc.rust-lang.org/std/boxed/struct.Box.html), [Vec](https://doc." -"rust-lang.org/std/vec/struct.Vec.html), [Rc](https://doc.rust-lang.org/std/" -"rc/struct.Rc.html) ou [Arc](https://doc.rust-lang.org/std/sync/struct.Arc." -"html). Ceux-ci encapsulent la propriété et l'allocation de mémoire par " -"divers moyens et empêchent les erreurs potentielles dans C." - -#: src/memory-management/rust.md:16 -#, fuzzy -msgid "" -"You may be asked about destructors here, the [Drop](https://doc.rust-lang." -"org/std/ops/trait.Drop.html) trait is the Rust equivalent." -msgstr "" -"Vous pouvez être interrogé sur les destructeurs ici, le trait [Drop](https://" -"doc.rust-lang.org/std/ops/trait.Drop.html) est l'équivalent de Rust." - -#: src/memory-management/comparison.md:3 -#, fuzzy -msgid "Here is a rough comparison of the memory management techniques." -msgstr "" -"Voici une comparaison approximative des techniques de gestion de la mémoire." - -#: src/memory-management/comparison.md:5 -#, fuzzy -msgid "Pros of Different Memory Management Techniques" -msgstr "Avantages des différentes techniques de gestion de la mémoire" - -#: src/memory-management/comparison.md:7 src/memory-management/comparison.md:22 -#, fuzzy -msgid "Manual like C:" -msgstr "Manuel comme C :" - -#: src/memory-management/comparison.md:8 src/memory-management/comparison.md:14 -#: src/memory-management/comparison.md:17 -#, fuzzy -msgid "No runtime overhead." -msgstr "Aucune surcharge d'exécution." - -#: src/memory-management/comparison.md:9 src/memory-management/comparison.md:26 -#, fuzzy -msgid "Automatic like Java:" -msgstr "Automatique comme Java :" - -#: src/memory-management/comparison.md:10 -#, fuzzy -msgid "Fully automatic." -msgstr "Entièrement automatique." - -#: src/memory-management/comparison.md:11 -#: src/memory-management/comparison.md:18 -#, fuzzy -msgid "Safe and correct." -msgstr "Sûr et correct." - -#: src/memory-management/comparison.md:12 -#: src/memory-management/comparison.md:29 -#, fuzzy -msgid "Scope-based like C++:" -msgstr "Basé sur la portée comme C++ :" - -#: src/memory-management/comparison.md:13 -#, fuzzy -msgid "Partially automatic." -msgstr "Partiellement automatique." - -#: src/memory-management/comparison.md:15 -#, fuzzy -msgid "Compiler-enforced scope-based like Rust:" -msgstr "Basé sur la portée imposée par le compilateur comme Rust :" - -#: src/memory-management/comparison.md:16 -#, fuzzy -msgid "Enforced by compiler." -msgstr "Appliqué par le compilateur." - -#: src/memory-management/comparison.md:20 -#, fuzzy -msgid "Cons of Different Memory Management Techniques" -msgstr "Inconvénients des différentes techniques de gestion de la mémoire" - -#: src/memory-management/comparison.md:23 -#, fuzzy -msgid "Use-after-free." -msgstr "Utiliser-après-libre." - -#: src/memory-management/comparison.md:24 -#, fuzzy -msgid "Double-frees." -msgstr "Double-gratuit." - -#: src/memory-management/comparison.md:25 -#, fuzzy -msgid "Memory leaks." -msgstr "Fuites de mémoire." - -#: src/memory-management/comparison.md:27 -#, fuzzy -msgid "Garbage collection pauses." -msgstr "La collecte des ordures s'arrête." - -#: src/memory-management/comparison.md:28 -#, fuzzy -msgid "Destructor delays." -msgstr "Retards de destructeur." - -#: src/memory-management/comparison.md:30 -#, fuzzy -msgid "Complex, opt-in by programmer." -msgstr "Complexe, opt-in par le programmeur." - -#: src/memory-management/comparison.md:31 -#, fuzzy -msgid "Potential for use-after-free." -msgstr "Potentiel d'utilisation-après-libre." - -#: src/memory-management/comparison.md:32 -#, fuzzy -msgid "Compiler-enforced and scope-based like Rust:" -msgstr "Renforcé par le compilateur et basé sur la portée comme Rust :" - -#: src/memory-management/comparison.md:33 -#, fuzzy -msgid "Some upfront complexity." -msgstr "Une certaine complexité initiale." - -#: src/memory-management/comparison.md:34 -#, fuzzy -msgid "Can reject valid programs." -msgstr "Peut rejeter les programmes valides." - -#: src/ownership.md:3 -#, fuzzy -msgid "" -"All variable bindings have a _scope_ where they are valid and it is an error " -"to use a variable outside its scope:" -msgstr "" -"Toutes les liaisons de variables ont un _scope_ où elles sont valides et " -"c'est une erreur de utiliser une variable en dehors de sa portée :" - -#: src/ownership.md:6 -msgid "" -"```rust,editable,compile_fail\n" -"struct Point(i32, i32);\n" -"\n" -"fn main() {\n" -" {\n" -" let p = Point(3, 4);\n" -" println!(\"x: {}\", p.0);\n" -" }\n" -" println!(\"y: {}\", p.1);\n" -"}\n" -"```" -msgstr "" - -#: src/ownership.md:18 -#, fuzzy -msgid "" -"At the end of the scope, the variable is _dropped_ and the data is freed." -msgstr "" -"A la fin du scope, la variable est _dropped_ et les données sont libérées." - -#: src/ownership.md:19 -#, fuzzy -msgid "A destructor can run here to free up resources." -msgstr "Un destructeur peut s'exécuter ici pour libérer des ressources." - -#: src/ownership.md:20 -#, fuzzy -msgid "We say that the variable _owns_ the value." -msgstr "On dit que la variable _possède_ la valeur." - -#: src/ownership/move-semantics.md:3 -#, fuzzy -msgid "An assignment will transfer ownership between variables:" -msgstr "Une affectation transférera la propriété entre les variables :" - -#: src/ownership/move-semantics.md:5 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let s1: String = String::from(\"Hello!\");\n" -" let s2: String = s1;\n" -" println!(\"s2: {s2}\");\n" -" // println!(\"s1: {s1}\");\n" -"}\n" -"```" -msgstr "" - -#: src/ownership/move-semantics.md:14 -#, fuzzy -msgid "The assignment of `s1` to `s2` transfers ownership." -msgstr "L'affectation de `s1` à `s2` transfère la propriété." - -#: src/ownership/move-semantics.md:15 -#, fuzzy -msgid "The data was _moved_ from `s1` and `s1` is no longer accessible." -msgstr "Les données ont été _déplacées_ de `s1` et `s1` n'est plus accessible." - -#: src/ownership/move-semantics.md:16 -#, fuzzy -msgid "When `s1` goes out of scope, nothing happens: it has no ownership." -msgstr "" -"Lorsque `s1` sort de la portée, rien ne se passe : il n'a pas de propriété." - -#: src/ownership/move-semantics.md:17 -#, fuzzy -msgid "When `s2` goes out of scope, the string data is freed." -msgstr "" -"Lorsque `s2` sort de la portée, les données de la chaîne sont libérées." - -#: src/ownership/move-semantics.md:18 -#, fuzzy -msgid "There is always _exactly_ one variable binding which owns a value." -msgstr "" -"Il y a toujours _exactement_ une liaison de variable qui possède une valeur." - -#: src/ownership/move-semantics.md:22 -#, fuzzy -msgid "" -"Mention that this is the opposite of the defaults in C++, which copies by " -"value unless you use `std::move` (and the move constructor is defined!)." -msgstr "" -"Mentionnez que c'est l'opposé des valeurs par défaut en C++, qui copie par " -"valeur à moins que vous n'utilisiez `std::move` (et que le constructeur de " -"déplacement soit défini !)." - -#: src/ownership/move-semantics.md:24 -#, fuzzy -msgid "In Rust, clones are explicit (by using `clone`)." -msgstr "Dans Rust, les clones sont explicites (en utilisant `clone`)." - -#: src/ownership/moved-strings-rust.md:3 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let s1: String = String::from(\"Rust\");\n" -" let s2: String = s1;\n" -"}\n" -"```" -msgstr "" - -#: src/ownership/moved-strings-rust.md:10 -#, fuzzy -msgid "The heap data from `s1` is reused for `s2`." -msgstr "Les données de tas de `s1` sont réutilisées pour `s2`." - -#: src/ownership/moved-strings-rust.md:11 -#, fuzzy -msgid "When `s1` goes out of scope, nothing happens (it has been moved from)." -msgstr "" -"Lorsque `s1` sort de la portée, rien ne se passe (il a été déplacé de)." - -#: src/ownership/moved-strings-rust.md:13 -#, fuzzy -msgid "Before move to `s2`:" -msgstr "Avant de passer à `s2` :" - -#: src/ownership/moved-strings-rust.md:15 -msgid "" -"```bob\n" -" Stack Heap\n" -".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - -.\n" -": : : :\n" -": s1 : : :\n" -": +-----------+-------+ : : +----+----+----+----+ :\n" -": | ptr | o---+---+-----+-->| R | u | s | t | :\n" -": | len | 4 | : : +----+----+----+----+ :\n" -": | capacity | 4 | : : :\n" -": +-----------+-------+ : : :\n" -": : `- - - - - - - - - - - - - -'\n" -": :\n" -"`- - - - - - - - - - - - - -'\n" -"```" -msgstr "" - -#: src/ownership/moved-strings-rust.md:30 -#, fuzzy -msgid "After move to `s2`:" -msgstr "Après le passage à `s2` :" - -#: src/ownership/moved-strings-rust.md:32 -msgid "" -"```bob\n" -" Stack Heap\n" -".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - -.\n" -": : : :\n" -": s1 \"(inaccessible)\" : : :\n" -": +-----------+-------+ : : +----+----+----+----+ :\n" -": | ptr | o---+---+--+--+-->| R | u | s | t | :\n" -": | len | 4 | : | : +----+----+----+----+ :\n" -": | capacity | 4 | : | : :\n" -": +-----------+-------+ : | : :\n" -": : | `- - - - - - - - - - - - - -'\n" -": s2 : |\n" -": +-----------+-------+ : |\n" -": | ptr | o---+---+--'\n" -": | len | 4 | :\n" -": | capacity | 4 | :\n" -": +-----------+-------+ :\n" -": :\n" -"`- - - - - - - - - - - - - -'\n" -"```" -msgstr "" - -#: src/ownership/double-free-modern-cpp.md:3 -#, fuzzy -msgid "Modern C++ solves this differently:" -msgstr "Le C++ moderne résout cela différemment :" - -#: src/ownership/double-free-modern-cpp.md:5 -msgid "" -"```c++\n" -"std::string s1 = \"Cpp\";\n" -"std::string s2 = s1; // Duplicate the data in s1.\n" -"```" -msgstr "" - -#: src/ownership/double-free-modern-cpp.md:10 -#, fuzzy -msgid "" -"The heap data from `s1` is duplicated and `s2` gets its own independent copy." -msgstr "" -"Les données de tas de `s1` sont dupliquées et `s2` obtient sa propre copie " -"indépendante." - -#: src/ownership/double-free-modern-cpp.md:11 -#, fuzzy -msgid "When `s1` and `s2` go out of scope, they each free their own memory." -msgstr "" -"Lorsque `s1` et `s2` sortent de la portée, ils libèrent chacun leur propre " -"mémoire." - -#: src/ownership/double-free-modern-cpp.md:13 -#, fuzzy -msgid "Before copy-assignment:" -msgstr "Avant l'affectation de copie :" - -#: src/ownership/double-free-modern-cpp.md:16 -msgid "" -"```bob\n" -" Stack Heap\n" -".- - - - - - - - - - - - - -. .- - - - - - - - - - - -.\n" -": : : :\n" -": s1 : : :\n" -": +-----------+-------+ : : +----+----+----+ :\n" -": | ptr | o---+---+--+--+-->| C | p | p | :\n" -": | len | 3 | : : +----+----+----+ :\n" -": | capacity | 3 | : : :\n" -": +-----------+-------+ : : :\n" -": : `- - - - - - - - - - - -'\n" -"`- - - - - - - - - - - - - -'\n" -"```" -msgstr "" - -#: src/ownership/double-free-modern-cpp.md:30 -#, fuzzy -msgid "After copy-assignment:" -msgstr "Après l'affectation de copie :" - -#: src/ownership/double-free-modern-cpp.md:32 -msgid "" -"```bob\n" -" Stack Heap\n" -".- - - - - - - - - - - - - -. .- - - - - - - - - - - -.\n" -": : : :\n" -": s1 : : :\n" -": +-----------+-------+ : : +----+----+----+ :\n" -": | ptr | o---+---+--+--+-->| C | p | p | :\n" -": | len | 3 | : : +----+----+----+ :\n" -": | capacity | 3 | : : :\n" -": +-----------+-------+ : : :\n" -": : : :\n" -": s2 : : :\n" -": +-----------+-------+ : : +----+----+----+ :\n" -": | ptr | o---+---+-----+-->| C | p | p | :\n" -": | len | 3 | : : +----+----+----+ :\n" -": | capacity | 3 | : : :\n" -": +-----------+-------+ : : :\n" -": : `- - - - - - - - - - - -'\n" -"`- - - - - - - - - - - - - -'\n" -"```" -msgstr "" - -#: src/ownership/moves-function-calls.md:3 -#, fuzzy -msgid "" -"When you pass a value to a function, the value is assigned to the function " -"parameter. This transfers ownership:" -msgstr "" -"Lorsque vous transmettez une valeur à une fonction, la valeur est affectée à " -"la fonction paramètre. Cela transfère la propriété :" - -#: src/ownership/moves-function-calls.md:6 -msgid "" -"```rust,editable\n" -"fn say_hello(name: String) {\n" -" println!(\"Hello {name}\")\n" -"}\n" -"\n" -"fn main() {\n" -" let name = String::from(\"Alice\");\n" -" say_hello(name);\n" -" // say_hello(name);\n" -"}\n" -"```" -msgstr "" - -#: src/ownership/moves-function-calls.md:20 -#, fuzzy -msgid "" -"With the first call to `say_hello`, `main` gives up ownership of `name`. " -"Afterwards, `name` cannot be used anymore within `main`." -msgstr "" -"Avec le premier appel à `say_hello`, `main` abandonne la propriété de " -"`name`. Ensuite, `name` ne peut plus être utilisé dans `main`." - -#: src/ownership/moves-function-calls.md:21 -#, fuzzy -msgid "" -"The heap memory allocated for `name` will be freed at the end of the " -"`say_hello` function." -msgstr "" -"La mémoire de tas allouée pour `name` sera libérée à la fin de la fonction " -"`say_hello`." - -#: src/ownership/moves-function-calls.md:22 -#, fuzzy -msgid "" -"`main` can retain ownership if it passes `name` as a reference (`&name`) and " -"if `say_hello` accepts a reference as a parameter." -msgstr "" -"`main` peut conserver la propriété s'il passe `name` comme référence " -"(`&name`) et si `say_hello` accepte une référence comme paramètre." - -#: src/ownership/moves-function-calls.md:23 -#, fuzzy -msgid "" -"Alternatively, `main` can pass a clone of `name` in the first call (`name." -"clone()`)." -msgstr "" -"Alternativement, `main` peut passer un clone de `name` dans le premier appel " -"(`name.clone()`)." - -#: src/ownership/moves-function-calls.md:24 -#, fuzzy -msgid "" -"Rust makes it harder than C++ to inadvertently create copies by making move " -"semantics the default, and by forcing programmers to make clones explicit." -msgstr "" -"Rust rend plus difficile que C++ la création de copies par inadvertance en " -"faisant de la sémantique de déplacement la valeur par défaut et en forçant " -"les programmeurs à rendre les clones explicites." - -#: src/ownership/copy-clone.md:3 -#, fuzzy -msgid "" -"While move semantics are the default, certain types are copied by default:" -msgstr "" -"Bien que la sémantique de déplacement soit la valeur par défaut, certains " -"types sont copiés par défaut :" - -#: src/ownership/copy-clone.md:5 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let x = 42;\n" -" let y = x;\n" -" println!(\"x: {x}\");\n" -" println!(\"y: {y}\");\n" -"}\n" -"```" -msgstr "" - -#: src/ownership/copy-clone.md:14 -#, fuzzy -msgid "These types implement the `Copy` trait." -msgstr "Ces types implémentent le trait \"Copier\"." - -#: src/ownership/copy-clone.md:16 -#, fuzzy -msgid "You can opt-in your own types to use copy semantics:" -msgstr "" -"Vous pouvez activer vos propres types pour utiliser la sémantique de copie :" - -#: src/ownership/copy-clone.md:18 -msgid "" -"```rust,editable\n" -"#[derive(Copy, Clone, Debug)]\n" -"struct Point(i32, i32);\n" -"\n" -"fn main() {\n" -" let p1 = Point(3, 4);\n" -" let p2 = p1;\n" -" println!(\"p1: {p1:?}\");\n" -" println!(\"p2: {p2:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/ownership/copy-clone.md:30 -#, fuzzy -msgid "After the assignment, both `p1` and `p2` own their own data." -msgstr "Après l'affectation, `p1` et `p2` possèdent leurs propres données." - -#: src/ownership/copy-clone.md:31 -#, fuzzy -msgid "We can also use `p1.clone()` to explicitly copy the data." -msgstr "" -"Nous pouvons également utiliser `p1.clone()` pour copier explicitement les " -"données." - -#: src/ownership/copy-clone.md:35 -#, fuzzy -msgid "Copying and cloning are not the same thing:" -msgstr "La copie et le clonage ne sont pas la même chose :" - -#: src/ownership/copy-clone.md:37 -#, fuzzy -msgid "" -"Copying refers to bitwise copies of memory regions and does not work on " -"arbitrary objects." -msgstr "" -"La copie fait référence aux copies au niveau du bit des régions de mémoire " -"et ne fonctionne pas sur des objets arbitraires." - -#: src/ownership/copy-clone.md:38 -#, fuzzy -msgid "" -"Copying does not allow for custom logic (unlike copy constructors in C++)." -msgstr "" -"La copie ne permet pas de logique personnalisée (contrairement aux " -"constructeurs de copie en C++)." - -#: src/ownership/copy-clone.md:39 -#, fuzzy -msgid "" -"Cloning is a more general operation and also allows for custom behavior by " -"implementing the `Clone` trait." -msgstr "" -"Le clonage est une opération plus générale et permet également un " -"comportement personnalisé en implémentant le trait \"Cloner\"." - -#: src/ownership/copy-clone.md:40 -#, fuzzy -msgid "Copying does not work on types that implement the `Drop` trait." -msgstr "" -"La copie ne fonctionne pas sur les types qui implémentent le trait `Drop`." - -#: src/ownership/copy-clone.md:42 src/ownership/lifetimes-function-calls.md:29 -#, fuzzy -msgid "In the above example, try the following:" -msgstr "Dans l'exemple ci-dessus, essayez ce qui suit :" - -#: src/ownership/copy-clone.md:44 -#, fuzzy -msgid "" -"Add a `String` field to `struct Point`. It will not compile because `String` " -"is not a `Copy` type." -msgstr "" -"Ajoutez un champ `String` à `struct Point`. Il ne sera pas compilé car " -"`String` n'est pas un type `Copy`." - -#: src/ownership/copy-clone.md:45 -#, fuzzy -msgid "" -"Remove `Copy` from the `derive` attribute. The compiler error is now in the " -"`println!` for `p1`." -msgstr "" -"Supprimer `Copy` de l'attribut `derive`. L'erreur du compilateur est " -"maintenant dans `println!` pour `p1`." - -#: src/ownership/copy-clone.md:46 -#, fuzzy -msgid "Show that it works if you clone `p1` instead." -msgstr "Montrez que cela fonctionne si vous clonez `p1` à la place." - -#: src/ownership/copy-clone.md:48 -#, fuzzy -msgid "" -"If students ask about `derive`, it is sufficient to say that this is a way " -"to generate code in Rust at compile time. In this case the default " -"implementations of `Copy` and `Clone` traits are generated." -msgstr "" -"Si les étudiants posent des questions sur \"dériver\", il suffit de dire que " -"c'est un moyen de générer du code dans Rust au moment de la compilation. " -"Dans ce cas, les implémentations par défaut des traits `Copy` et `Clone` " -"sont générées." - -#: src/ownership/borrowing.md:3 -#, fuzzy -msgid "" -"Instead of transferring ownership when calling a function, you can let a " -"function _borrow_ the value:" -msgstr "" -"Au lieu de transférer la propriété lors de l'appel d'une fonction, vous " -"pouvez laisser une la fonction _emprunte_ la valeur :" - -#: src/ownership/borrowing.md:6 -msgid "" -"```rust,editable\n" -"#[derive(Debug)]\n" -"struct Point(i32, i32);\n" -"\n" -"fn add(p1: &Point, p2: &Point) -> Point {\n" -" Point(p1.0 + p2.0, p1.1 + p2.1)\n" -"}\n" -"\n" -"fn main() {\n" -" let p1 = Point(3, 4);\n" -" let p2 = Point(10, 20);\n" -" let p3 = add(&p1, &p2);\n" -" println!(\"{p1:?} + {p2:?} = {p3:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/ownership/borrowing.md:22 -#, fuzzy -msgid "The `add` function _borrows_ two points and returns a new point." -msgstr "La fonction `add` _emprunte_ deux points et renvoie un nouveau point." - -#: src/ownership/borrowing.md:23 -#, fuzzy -msgid "The caller retains ownership of the inputs." -msgstr "L'appelant conserve la propriété des entrées." - -#: src/ownership/borrowing.md:27 -#, fuzzy -msgid "Notes on stack returns:" -msgstr "Remarques sur les retours de pile :" - -#: src/ownership/borrowing.md:28 -msgid "" -"Demonstrate that the return from `add` is cheap because the compiler can " -"eliminate the copy operation. Change the above code to print stack addresses " -"and run it on the [Playground](https://play.rust-lang.org/). In the " -"\"DEBUG\" optimization level, the addresses should change, while they stay " -"the same when changing to the \"RELEASE\" setting:" -msgstr "" - -#: src/ownership/borrowing.md:30 -msgid "" -"```rust,editable\n" -"#[derive(Debug)]\n" -"struct Point(i32, i32);\n" -"\n" -"fn add(p1: &Point, p2: &Point) -> Point {\n" -" let p = Point(p1.0 + p2.0, p1.1 + p2.1);\n" -" println!(\"&p.0: {:p}\", &p.0);\n" -" p\n" -"}\n" -"\n" -"fn main() {\n" -" let p1 = Point(3, 4);\n" -" let p2 = Point(10, 20);\n" -" let p3 = add(&p1, &p2);\n" -" println!(\"&p3.0: {:p}\", &p3.0);\n" -" println!(\"{p1:?} + {p2:?} = {p3:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/ownership/borrowing.md:48 -msgid "The Rust compiler can do return value optimization (RVO)." -msgstr "" - -#: src/ownership/borrowing.md:49 -msgid "" -"In C++, copy elision has to be defined in the language specification because " -"constructors can have side effects. In Rust, this is not an issue at all. If " -"RVO did not happen, Rust will always perform a simple and efficient `memcpy` " -"copy." -msgstr "" - -#: src/ownership/shared-unique-borrows.md:3 -#, fuzzy -msgid "Rust puts constraints on the ways you can borrow values:" -msgstr "" -"Rust impose des contraintes sur la manière dont vous pouvez emprunter des " -"valeurs :" - -#: src/ownership/shared-unique-borrows.md:5 -#, fuzzy -msgid "You can have one or more `&T` values at any given time, _or_" -msgstr "Vous pouvez avoir une ou plusieurs valeurs `&T` à tout moment, _ou_" - -#: src/ownership/shared-unique-borrows.md:6 -#, fuzzy -msgid "You can have exactly one `&mut T` value." -msgstr "Vous pouvez avoir exactement une valeur `&mut T`." - -#: src/ownership/shared-unique-borrows.md:8 -msgid "" -"```rust,editable,compile_fail\n" -"fn main() {\n" -" let mut a: i32 = 10;\n" -" let b: &i32 = &a;\n" -"\n" -" {\n" -" let c: &mut i32 = &mut a;\n" -" *c = 20;\n" -" }\n" -"\n" -" println!(\"a: {a}\");\n" -" println!(\"b: {b}\");\n" -"}\n" -"```" -msgstr "" - -#: src/ownership/shared-unique-borrows.md:25 -#, fuzzy -msgid "" -"The above code does not compile because `a` is borrowed as mutable (through " -"`c`) and as immutable (through `b`) at the same time." -msgstr "" -"Le code ci-dessus ne se compile pas car 'a' est emprunté comme mutable (via " -"'c') et comme immuable (via 'b') en même temps." - -#: src/ownership/shared-unique-borrows.md:26 -#, fuzzy -msgid "" -"Move the `println!` statement for `b` before the scope that introduces `c` " -"to make the code compile." -msgstr "" -"Déplacez l'instruction `println!` pour `b` avant la portée qui introduit `c` " -"pour que le code soit compilé." - -#: src/ownership/shared-unique-borrows.md:27 -#, fuzzy -msgid "" -"After that change, the compiler realizes that `b` is only ever used before " -"the new mutable borrow of `a` through `c`. This is a feature of the borrow " -"checker called \"non-lexical lifetimes\"." -msgstr "" -"Après ce changement, le compilateur se rend compte que 'b' n'est utilisé " -"qu'avant le nouvel emprunt mutable de 'a' à 'c'. Il s'agit d'une " -"fonctionnalité du vérificateur d'emprunt appelée \"durées de vie non " -"lexicales\"." - -#: src/ownership/lifetimes.md:3 -#, fuzzy -msgid "A borrowed value has a _lifetime_:" -msgstr "Une valeur empruntée a une _durée de vie_ :" - -#: src/ownership/lifetimes.md:5 -msgid "The lifetime can be implicit: `add(p1: &Point, p2: &Point) -> Point`." -msgstr "" - -#: src/ownership/lifetimes.md:6 -msgid "Lifetimes can also be explicit: `&'a Point`, `&'document str`." -msgstr "" - -#: src/ownership/lifetimes.md:7 src/ownership/lifetimes-function-calls.md:23 -#, fuzzy -msgid "" -"Read `&'a Point` as \"a borrowed `Point` which is valid for at least the " -"lifetime `a`\"." -msgstr "" -"Lire `&'a Point` comme \"un `Point` emprunté qui est valide pour au moins " -"durée de vie 'a'\"." - -#: src/ownership/lifetimes.md:9 -msgid "" -"Lifetimes are always inferred by the compiler: you cannot assign a lifetime " -"yourself." -msgstr "" - -#: src/ownership/lifetimes.md:11 -msgid "" -"Lifetime annotations create constraints; the compiler verifies that there is " -"a valid solution." -msgstr "" - -#: src/ownership/lifetimes.md:13 -msgid "" -"Lifetimes for function arguments and return values must be fully specified, " -"but Rust allows lifetimes to be elided in most cases with [a few simple " -"rules](https://doc.rust-lang.org/nomicon/lifetime-elision.html)." -msgstr "" - -#: src/ownership/lifetimes-function-calls.md:3 -#, fuzzy -msgid "" -"In addition to borrowing its arguments, a function can return a borrowed " -"value:" -msgstr "" -"En plus d'emprunter ses arguments, une fonction peut renvoyer une valeur " -"empruntée :" - -#: src/ownership/lifetimes-function-calls.md:5 -msgid "" -"```rust,editable\n" -"#[derive(Debug)]\n" -"struct Point(i32, i32);\n" -"\n" -"fn left_most<'a>(p1: &'a Point, p2: &'a Point) -> &'a Point {\n" -" if p1.0 < p2.0 { p1 } else { p2 }\n" -"}\n" -"\n" -"fn main() {\n" -" let p1: Point = Point(10, 10);\n" -" let p2: Point = Point(20, 20);\n" -" let p3: &Point = left_most(&p1, &p2);\n" -" println!(\"left-most point: {:?}\", p3);\n" -"}\n" -"```" -msgstr "" - -#: src/ownership/lifetimes-function-calls.md:21 -#, fuzzy -msgid "`'a` is a generic parameter, it is inferred by the compiler." -msgstr "`'a` est un paramètre générique, il est déduit par le compilateur." - -#: src/ownership/lifetimes-function-calls.md:22 -#, fuzzy -msgid "Lifetimes start with `'` and `'a` is a typical default name." -msgstr "" -"Les durées de vie commencent par `'` et `'a` est un nom par défaut typique." - -#: src/ownership/lifetimes-function-calls.md:25 -#, fuzzy -msgid "" -"The _at least_ part is important when parameters are in different scopes." -msgstr "" -"La partie _au moins_ est importante lorsque les paramètres sont dans des " -"portées différentes." - -#: src/ownership/lifetimes-function-calls.md:31 -msgid "" -"Move the declaration of `p2` and `p3` into a new scope (`{ ... }`), " -"resulting in the following code:" -msgstr "" - -#: src/ownership/lifetimes-function-calls.md:32 -msgid "" -"```rust,ignore\n" -"#[derive(Debug)]\n" -"struct Point(i32, i32);\n" -"\n" -"fn left_most<'a>(p1: &'a Point, p2: &'a Point) -> &'a Point {\n" -" if p1.0 < p2.0 { p1 } else { p2 }\n" -"}\n" -"\n" -"fn main() {\n" -" let p1: Point = Point(10, 10);\n" -" let p3: &Point;\n" -" {\n" -" let p2: Point = Point(20, 20);\n" -" p3 = left_most(&p1, &p2);\n" -" }\n" -" println!(\"left-most point: {:?}\", p3);\n" -"}\n" -"```" -msgstr "" - -#: src/ownership/lifetimes-function-calls.md:50 -msgid "Note how this does not compile since `p3` outlives `p2`." -msgstr "" - -#: src/ownership/lifetimes-function-calls.md:52 -msgid "" -"Reset the workspace and change the function signature to `fn left_most<'a, " -"'b>(p1: &'a Point, p2: &'a Point) -> &'b Point`. This will not compile " -"because the relationship between the lifetimes `'a` and `'b` is unclear." -msgstr "" - -#: src/ownership/lifetimes-function-calls.md:53 -msgid "Another way to explain it:" -msgstr "" - -#: src/ownership/lifetimes-function-calls.md:54 -msgid "" -"Two references to two values are borrowed by a function and the function " -"returns another reference." -msgstr "" - -#: src/ownership/lifetimes-function-calls.md:56 -msgid "" -"It must have come from one of those two inputs (or from a global variable)." -msgstr "" - -#: src/ownership/lifetimes-function-calls.md:57 -msgid "" -"Which one is it? The compiler needs to know, so at the call site the " -"returned reference is not used for longer than a variable from where the " -"reference came from." -msgstr "" - -#: src/ownership/lifetimes-data-structures.md:3 -#, fuzzy -msgid "" -"If a data type stores borrowed data, it must be annotated with a lifetime:" -msgstr "" -"Si un type de données stocke des données empruntées, il doit être annoté " -"avec une durée de vie :" - -#: src/ownership/lifetimes-data-structures.md:5 -msgid "" -"```rust,editable\n" -"#[derive(Debug)]\n" -"struct Highlight<'doc>(&'doc str);\n" -"\n" -"fn erase(text: String) {\n" -" println!(\"Bye {text}!\");\n" -"}\n" -"\n" -"fn main() {\n" -" let text = String::from(\"The quick brown fox jumps over the lazy dog." -"\");\n" -" let fox = Highlight(&text[4..19]);\n" -" let dog = Highlight(&text[35..43]);\n" -" // erase(text);\n" -" println!(\"{fox:?}\");\n" -" println!(\"{dog:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/ownership/lifetimes-data-structures.md:25 -#, fuzzy -msgid "" -"In the above example, the annotation on `Highlight` enforces that the data " -"underlying the contained `&str` lives at least as long as any instance of " -"`Highlight` that uses that data." -msgstr "" -"Dans l'exemple ci-dessus, l'annotation sur `Highlight` impose que les " -"données sous-jacentes au `&str` contenu vivent au moins aussi longtemps que " -"toute instance de `Highlight` qui utilise ces données." - -#: src/ownership/lifetimes-data-structures.md:26 -#, fuzzy -msgid "" -"If `text` is consumed before the end of the lifetime of `fox` (or `dog`), " -"the borrow checker throws an error." -msgstr "" -"Si `text` est consommé avant la fin de la durée de vie de `fox` (ou `dog`), " -"le vérificateur d'emprunt génère une erreur." - -#: src/ownership/lifetimes-data-structures.md:27 -#, fuzzy -msgid "" -"Types with borrowed data force users to hold on to the original data. This " -"can be useful for creating lightweight views, but it generally makes them " -"somewhat harder to use." -msgstr "" -"Les types avec des données empruntées obligent les utilisateurs à conserver " -"les données d'origine. Cela peut être utile pour créer des vues légères, " -"mais cela les rend généralement un peu plus difficiles à utiliser." - -#: src/ownership/lifetimes-data-structures.md:28 -#, fuzzy -msgid "When possible, make data structures own their data directly." -msgstr "" -"Dans la mesure du possible, faites en sorte que les structures de données " -"soient directement propriétaires de leurs données." - -#: src/ownership/lifetimes-data-structures.md:29 -#, fuzzy -msgid "" -"Some structs with multiple references inside can have more than one lifetime " -"annotation. This can be necessary if there is a need to describe lifetime " -"relationships between the references themselves, in addition to the lifetime " -"of the struct itself. Those are very advanced use cases." -msgstr "" -"Certaines structures contenant plusieurs références peuvent avoir plusieurs " -"annotations de durée de vie. Cela peut être nécessaire s'il est nécessaire " -"de décrire les relations de durée de vie entre les références elles-mêmes, " -"en plus de la durée de vie de la structure elle-même. Ce sont des cas " -"d'utilisation très avancés." - -#: src/exercises/day-1/afternoon.md:1 -#, fuzzy -msgid "Day 1: Afternoon Exercises" -msgstr "Jour 1 : Exercices de l'après-midi" - -#: src/exercises/day-1/afternoon.md:3 -#, fuzzy -msgid "We will look at two things:" -msgstr "Nous allons regarder deux choses :" - -#: src/exercises/day-1/afternoon.md:5 -#, fuzzy -msgid "A small book library," -msgstr "Une petite bibliothèque de livres," - -#: src/exercises/day-1/afternoon.md:7 -#, fuzzy -msgid "Iterators and ownership (hard)." -msgstr "Itérateurs et propriété (difficile)." - -#: src/exercises/day-1/book-library.md:3 -#, fuzzy -msgid "" -"We will learn much more about structs and the `Vec` type tomorrow. For " -"now, you just need to know part of its API:" -msgstr "" -"Nous en apprendrons beaucoup plus sur les structures et le type `Vec` " -"demain. Pour l'instant, vous avez juste besoin de connaître une partie de " -"son API :" - -#: src/exercises/day-1/book-library.md:6 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let mut vec = vec![10, 20];\n" -" vec.push(30);\n" -" let midpoint = vec.len() / 2;\n" -" println!(\"middle value: {}\", vec[midpoint]);\n" -" for item in &vec {\n" -" println!(\"item: {item}\");\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/exercises/day-1/book-library.md:18 -#, fuzzy -msgid "" -"Use this to model a library's book collection. Copy the code below to " -" and update the types to make it compile:" -msgstr "" -"Utilisez-le pour créer une application de bibliothèque. Copiez le code ci-" -"dessous pour et mettez à jour les types pour " -"le faire compiler :" - -#: src/exercises/day-1/book-library.md:21 -msgid "" -"```rust,should_panic\n" -"struct Library {\n" -" books: Vec,\n" -"}\n" -"\n" -"struct Book {\n" -" title: String,\n" -" year: u16,\n" -"}\n" -"\n" -"impl Book {\n" -" // This is a constructor, used below.\n" -" fn new(title: &str, year: u16) -> Book {\n" -" Book {\n" -" title: String::from(title),\n" -" year,\n" -" }\n" -" }\n" -"}\n" -"\n" -"// Implement the methods below. Update the `self` parameter to\n" -"// indicate the method's required level of ownership over the object:\n" -"//\n" -"// - `&self` for shared read-only access,\n" -"// - `&mut self` for unique and mutable access,\n" -"// - `self` for unique access by value.\n" -"impl Library {\n" -" fn new() -> Library {\n" -" todo!(\"Initialize and return a `Library` value\")\n" -" }\n" -"\n" -" //fn len(self) -> usize {\n" -" // todo!(\"Return the length of `self.books`\")\n" -" //}\n" -"\n" -" //fn is_empty(self) -> bool {\n" -" // todo!(\"Return `true` if `self.books` is empty\")\n" -" //}\n" -"\n" -" //fn add_book(self, book: Book) {\n" -" // todo!(\"Add a new book to `self.books`\")\n" -" //}\n" -"\n" -" //fn print_books(self) {\n" -" // todo!(\"Iterate over `self.books` and each book's title and " -"year\")\n" -" //}\n" -"\n" -" //fn oldest_book(self) -> Option<&Book> {\n" -" // todo!(\"Return a reference to the oldest book (if any)\")\n" -" //}\n" -"}\n" -"\n" -"// This shows the desired behavior. Uncomment the code below and\n" -"// implement the missing methods. You will need to update the\n" -"// method signatures, including the \"self\" parameter! You may\n" -"// also need to update the variable bindings within main.\n" -"fn main() {\n" -" let library = Library::new();\n" -"\n" -" //println!(\"The library is empty: library.is_empty() -> {}\", library." -"is_empty());\n" -" //\n" -" //library.add_book(Book::new(\"Lord of the Rings\", 1954));\n" -" //library.add_book(Book::new(\"Alice's Adventures in Wonderland\", " -"1865));\n" -" //\n" -" //println!(\"The library is no longer empty: library.is_empty() -> {}\", " -"library.is_empty());\n" -" //\n" -" //\n" -" //library.print_books();\n" -" //\n" -" //match library.oldest_book() {\n" -" // Some(book) => println!(\"The oldest book is {}\", book.title),\n" -" // None => println!(\"The library is empty!\"),\n" -" //}\n" -" //\n" -" //println!(\"The library has {} books\", library.len());\n" -" //library.print_books();\n" -"}\n" -"```" -msgstr "" - -#: src/exercises/day-1/book-library.md:102 -#, fuzzy -msgid "[Solution](solutions-afternoon.md#designing-a-library)" -msgstr "[Solution](solutions-afternoon.md#designing-a-library)" - -#: src/exercises/day-1/iterators-and-ownership.md:3 -#, fuzzy -msgid "" -"The ownership model of Rust affects many APIs. An example of this is the " -"[`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) and " -"[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html) " -"traits." -msgstr "" -"Le modèle de propriété de Rust affecte de nombreuses API. Un exemple en est " -"le [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) et " -"[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html) " -"caractéristiques." - -#: src/exercises/day-1/iterators-and-ownership.md:8 src/bare-metal/no_std.md:28 -#, fuzzy -msgid "`Iterator`" -msgstr "`Itérateur`" - -#: src/exercises/day-1/iterators-and-ownership.md:10 -#, fuzzy -msgid "" -"Traits are like interfaces: they describe behavior (methods) for a type. The " -"`Iterator` trait simply says that you can call `next` until you get `None` " -"back:" -msgstr "" -"Les traits sont comme des interfaces : ils décrivent le comportement " -"(méthodes) d'un type. Le Le trait `Iterator` indique simplement que vous " -"pouvez appeler `next` jusqu'à ce que vous obteniez `None` :" - -#: src/exercises/day-1/iterators-and-ownership.md:13 -msgid "" -"```rust\n" -"pub trait Iterator {\n" -" type Item;\n" -" fn next(&mut self) -> Option;\n" -"}\n" -"```" -msgstr "" - -#: src/exercises/day-1/iterators-and-ownership.md:20 -#, fuzzy -msgid "You use this trait like this:" -msgstr "Vous utilisez ce trait comme ceci :" - -#: src/exercises/day-1/iterators-and-ownership.md:22 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let v: Vec = vec![10, 20, 30];\n" -" let mut iter = v.iter();\n" -"\n" -" println!(\"v[0]: {:?}\", iter.next());\n" -" println!(\"v[1]: {:?}\", iter.next());\n" -" println!(\"v[2]: {:?}\", iter.next());\n" -" println!(\"No more items: {:?}\", iter.next());\n" -"}\n" -"```" -msgstr "" - -#: src/exercises/day-1/iterators-and-ownership.md:34 -#, fuzzy -msgid "What is the type returned by the iterator? Test your answer here:" -msgstr "Quel est le type retourné par l'itérateur ? Testez votre réponse ici :" - -#: src/exercises/day-1/iterators-and-ownership.md:36 -msgid "" -"```rust,editable,compile_fail\n" -"fn main() {\n" -" let v: Vec = vec![10, 20, 30];\n" -" let mut iter = v.iter();\n" -"\n" -" let v0: Option<..> = iter.next();\n" -" println!(\"v0: {v0:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/exercises/day-1/iterators-and-ownership.md:46 -#, fuzzy -msgid "Why is this type used?" -msgstr "Pourquoi ce type est-il utilisé ?" - -#: src/exercises/day-1/iterators-and-ownership.md:48 -#, fuzzy -msgid "`IntoIterator`" -msgstr "`IntoIterator`" - -#: src/exercises/day-1/iterators-and-ownership.md:50 -#, fuzzy -msgid "" -"The `Iterator` trait tells you how to _iterate_ once you have created an " -"iterator. The related trait `IntoIterator` tells you how to create the " -"iterator:" -msgstr "" -"Le trait `Iterator` vous indique comment _itérer_ une fois que vous avez " -"créé un itérateur. Le trait connexe \"IntoIterator\" vous indique comment " -"créer l'itérateur :" - -#: src/exercises/day-1/iterators-and-ownership.md:53 -msgid "" -"```rust\n" -"pub trait IntoIterator {\n" -" type Item;\n" -" type IntoIter: Iterator;\n" -"\n" -" fn into_iter(self) -> Self::IntoIter;\n" -"}\n" -"```" -msgstr "" - -#: src/exercises/day-1/iterators-and-ownership.md:62 -#, fuzzy -msgid "" -"The syntax here means that every implementation of `IntoIterator` must " -"declare two types:" -msgstr "" -"La syntaxe ici signifie que chaque implémentation de `IntoIterator` doit " -"déclarer deux types :" - -#: src/exercises/day-1/iterators-and-ownership.md:65 -#, fuzzy -msgid "`Item`: the type we iterate over, such as `i8`," -msgstr "`Item` : le type sur lequel nous itérons, tel que `i8`," - -#: src/exercises/day-1/iterators-and-ownership.md:66 -#, fuzzy -msgid "`IntoIter`: the `Iterator` type returned by the `into_iter` method." -msgstr "`IntoIter` : le type `Iterator` renvoyé par la méthode `into_iter`." - -#: src/exercises/day-1/iterators-and-ownership.md:68 -#, fuzzy -msgid "" -"Note that `IntoIter` and `Item` are linked: the iterator must have the same " -"`Item` type, which means that it returns `Option`" -msgstr "" -"Notez que `IntoIter` et `Item` sont liés : l'itérateur doit avoir le même " -"Type `Item`, ce qui signifie qu'il renvoie `Option`" - -#: src/exercises/day-1/iterators-and-ownership.md:71 -#, fuzzy -msgid "Like before, what is the type returned by the iterator?" -msgstr "Comme précédemment, quel est le type retourné par l'itérateur ?" - -#: src/exercises/day-1/iterators-and-ownership.md:73 -msgid "" -"```rust,editable,compile_fail\n" -"fn main() {\n" -" let v: Vec = vec![String::from(\"foo\"), String::" -"from(\"bar\")];\n" -" let mut iter = v.into_iter();\n" -"\n" -" let v0: Option<..> = iter.next();\n" -" println!(\"v0: {v0:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/exercises/day-1/iterators-and-ownership.md:83 -#, fuzzy -msgid "`for` Loops" -msgstr "Boucles `for`" - -#: src/exercises/day-1/iterators-and-ownership.md:85 -#, fuzzy -msgid "" -"Now that we know both `Iterator` and `IntoIterator`, we can build `for` " -"loops. They call `into_iter()` on an expression and iterates over the " -"resulting iterator:" -msgstr "" -"Maintenant que nous connaissons à la fois `Iterator` et `IntoIterator`, nous " -"pouvons construire des boucles `for`. Ils appellent `into_iter()` sur une " -"expression et itèrent sur le résultat itérateur :" - -#: src/exercises/day-1/iterators-and-ownership.md:89 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let v: Vec = vec![String::from(\"foo\"), String::" -"from(\"bar\")];\n" -"\n" -" for word in &v {\n" -" println!(\"word: {word}\");\n" -" }\n" -"\n" -" for word in v {\n" -" println!(\"word: {word}\");\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/exercises/day-1/iterators-and-ownership.md:103 -#, fuzzy -msgid "What is the type of `word` in each loop?" -msgstr "Quel est le type de \"mot\" dans chaque boucle ?" - -#: src/exercises/day-1/iterators-and-ownership.md:105 -#, fuzzy -msgid "" -"Experiment with the code above and then consult the documentation for [`impl " -"IntoIterator for &Vec`](https://doc.rust-lang.org/std/vec/struct.Vec." -"html#impl-IntoIterator-for-%26%27a%20Vec%3CT%2C%20A%3E) and [`impl " -"IntoIterator for Vec`](https://doc.rust-lang.org/std/vec/struct.Vec." -"html#impl-IntoIterator-for-Vec%3CT%2C%20A%3E) to check your answers." -msgstr "" -"Expérimentez avec le code ci-dessus, puis consultez la documentation de " -"[`impl IntoIterator pour &Vec`](https://doc.rust-lang.org/std/vec/struct." -"Vec.html#impl-IntoIterator-for-%26%27a%20Vec%3CT%2C%20A%3E) et [`impl " -"IntoIterator for Vec`](https://doc.rust-lang.org/std/vec/struct.Vec." -"html#impl-IntoIterator-for-Vec%3CT%2C%20A%3E) pour vérifier vos réponses." - -#: src/welcome-day-2.md:1 -#, fuzzy -msgid "Welcome to Day 2" -msgstr "Bienvenue au jour 2" - -#: src/welcome-day-2.md:3 -#, fuzzy -msgid "Now that we have seen a fair amount of Rust, we will continue with:" -msgstr "" -"Maintenant que nous avons vu une bonne quantité de Rust, nous allons " -"continuer avec :" - -#: src/welcome-day-2.md:5 -#, fuzzy -msgid "Structs, enums, methods." -msgstr "Structures, énumérations, méthodes." - -#: src/welcome-day-2.md:7 -#, fuzzy -msgid "Pattern matching: destructuring enums, structs, and arrays." -msgstr "" -"Pattern matching : déstructuration des énumérations, des structures et des " -"tableaux." - -#: src/welcome-day-2.md:9 -#, fuzzy -msgid "" -"Control flow constructs: `if`, `if let`, `while`, `while let`, `break`, and " -"`continue`." -msgstr "" -"Constructions de flux de contrôle : `if`, `if let`, `while`, `while let`, " -"`break` et 'continuer'." - -#: src/welcome-day-2.md:12 -#, fuzzy -msgid "" -"The Standard Library: `String`, `Option` and `Result`, `Vec`, `HashMap`, " -"`Rc` and `Arc`." -msgstr "" -"La bibliothèque standard : `String`, `Option` et `Result`, `Vec`, `HashMap`, " -"`Rc` et \"Arc\"." - -#: src/welcome-day-2.md:15 -#, fuzzy -msgid "Modules: visibility, paths, and filesystem hierarchy." -msgstr "Modules : visibilité, chemins et hiérarchie du système de fichiers." - -#: src/structs.md:3 -#, fuzzy -msgid "Like C and C++, Rust has support for custom structs:" -msgstr "Comme C et C++, Rust prend en charge les structures personnalisées :" - -#: src/structs.md:5 -msgid "" -"```rust,editable\n" -"struct Person {\n" -" name: String,\n" -" age: u8,\n" -"}\n" -"\n" -"fn main() {\n" -" let mut peter = Person {\n" -" name: String::from(\"Peter\"),\n" -" age: 27,\n" -" };\n" -" println!(\"{} is {} years old\", peter.name, peter.age);\n" -" \n" -" peter.age = 28;\n" -" println!(\"{} is {} years old\", peter.name, peter.age);\n" -" \n" -" let jackie = Person {\n" -" name: String::from(\"Jackie\"),\n" -" ..peter\n" -" };\n" -" println!(\"{} is {} years old\", jackie.name, jackie.age);\n" -"}\n" -"```" -msgstr "" - -#: src/structs.md:31 src/enums.md:34 src/enums/sizes.md:29 src/methods.md:30 -#: src/methods/example.md:46 src/pattern-matching.md:25 -#: src/pattern-matching/match-guards.md:22 src/control-flow/blocks.md:43 -#, fuzzy -msgid "Key Points:" -msgstr "Points clés:" - -#: src/structs.md:33 -msgid "Structs work like in C or C++." -msgstr "" - -#: src/structs.md:34 -msgid "Like in C++, and unlike in C, no typedef is needed to define a type." -msgstr "" - -#: src/structs.md:35 -msgid "Unlike in C++, there is no inheritance between structs." -msgstr "" - -#: src/structs.md:36 -msgid "" -"Methods are defined in an `impl` block, which we will see in following " -"slides." -msgstr "" - -#: src/structs.md:37 -msgid "" -"This may be a good time to let people know there are different types of " -"structs. " -msgstr "" - -#: src/structs.md:38 -msgid "" -"Zero-sized structs `e.g., struct Foo;` might be used when implementing a " -"trait on some type but don’t have any data that you want to store in the " -"value itself. " -msgstr "" - -#: src/structs.md:39 -msgid "" -"The next slide will introduce Tuple structs, used when the field names are " -"not important." -msgstr "" - -#: src/structs.md:40 -msgid "" -"The syntax `..peter` allows us to copy the majority of the fields from the " -"old struct without having to explicitly type it all out. It must always be " -"the last element." -msgstr "" - -#: src/structs/tuple-structs.md:3 -#, fuzzy -msgid "If the field names are unimportant, you can use a tuple struct:" -msgstr "" -"Si les noms de champ ne sont pas importants, vous pouvez utiliser une " -"structure tuple :" - -#: src/structs/tuple-structs.md:5 -msgid "" -"```rust,editable\n" -"struct Point(i32, i32);\n" -"\n" -"fn main() {\n" -" let p = Point(17, 23);\n" -" println!(\"({}, {})\", p.0, p.1);\n" -"}\n" -"```" -msgstr "" - -#: src/structs/tuple-structs.md:14 -#, fuzzy -msgid "This is often used for single-field wrappers (called newtypes):" -msgstr "" -"Ceci est souvent utilisé pour les wrappers à champ unique (appelés newtypes):" - -#: src/structs/tuple-structs.md:16 -msgid "" -"```rust,editable,compile_fail\n" -"struct PoundsOfForce(f64);\n" -"struct Newtons(f64);\n" -"\n" -"fn compute_thruster_force() -> PoundsOfForce {\n" -" todo!(\"Ask a rocket scientist at NASA\")\n" -"}\n" -"\n" -"fn set_thruster_force(force: Newtons) {\n" -" // ...\n" -"}\n" -"\n" -"fn main() {\n" -" let force = compute_thruster_force();\n" -" set_thruster_force(force);\n" -"}\n" -"\n" -"```" -msgstr "" - -#: src/structs/tuple-structs.md:37 -#, fuzzy -msgid "" -"Newtypes are a great way to encode additional information about the value in " -"a primitive type, for example:" -msgstr "" -"Les nouveaux types sont un excellent moyen d'encoder des informations " -"supplémentaires sur la valeur dans un type primitif, par exemple :" - -#: src/structs/tuple-structs.md:38 -#, fuzzy -msgid "The number is measured in some units: `Newtons` in the example above." -msgstr "" -"Le nombre est mesuré dans certaines unités : `Newtons` dans l'exemple ci-" -"dessus." - -#: src/structs/tuple-structs.md:39 -#, fuzzy -msgid "" -"The value passed some validation when it was created, so you no longer have " -"to validate it again at every use: 'PhoneNumber(String)`or`OddNumber(u32)\\`." -msgstr "" -"La valeur a été validée lors de sa création, vous n'avez donc plus besoin de " -"la valider à chaque utilisation : 'PhoneNumber(String)`ou`OddNumber(u32)\\`." - -#: src/structs/tuple-structs.md:40 -#, fuzzy -msgid "" -"Demonstrate how to add a `f64` value to a `Newtons` type by accessing the " -"single field in the newtype." -msgstr "" -"Montrez comment ajouter une valeur `f64` à un type `Newtons` en accédant au " -"champ unique dans le nouveau type." - -#: src/structs/tuple-structs.md:41 -#, fuzzy -msgid "" -"Rust generally doesn’t like inexplicit things, like automatic unwrapping or " -"for instance using booleans as integers." -msgstr "" -"Rust n'aime généralement pas les choses inexplicites, comme le déballage " -"automatique ou, par exemple, l'utilisation de booléens comme entiers." - -#: src/structs/tuple-structs.md:42 -#, fuzzy -msgid "Operator overloading is discussed on Day 3 (generics)." -msgstr "La surcharge des opérateurs est discutée le jour 3 (génériques)." - -#: src/structs/tuple-structs.md:43 -msgid "" -"The example is a subtle reference to the [Mars Climate Orbiter](https://en." -"wikipedia.org/wiki/Mars_Climate_Orbiter) failure." -msgstr "" - -#: src/structs/field-shorthand.md:3 -#, fuzzy -msgid "" -"If you already have variables with the right names, then you can create the " -"struct using a shorthand:" -msgstr "" -"Si vous avez déjà des variables avec les bons noms, vous pouvez créer le " -"struct en utilisant un raccourci :" - -#: src/structs/field-shorthand.md:6 -msgid "" -"```rust,editable\n" -"#[derive(Debug)]\n" -"struct Person {\n" -" name: String,\n" -" age: u8,\n" -"}\n" -"\n" -"impl Person {\n" -" fn new(name: String, age: u8) -> Person {\n" -" Person { name, age }\n" -" }\n" -"}\n" -"\n" -"fn main() {\n" -" let peter = Person::new(String::from(\"Peter\"), 27);\n" -" println!(\"{peter:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/structs/field-shorthand.md:27 -msgid "" -"The `new` function could be written using `Self` as a type, as it is " -"interchangeable with the struct type name" -msgstr "" - -#: src/structs/field-shorthand.md:29 -msgid "" -"```rust,editable\n" -"#[derive(Debug)]\n" -"struct Person {\n" -" name: String,\n" -" age: u8,\n" -"}\n" -"impl Person {\n" -" fn new(name: String, age: u8) -> Self {\n" -" Self { name, age }\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/structs/field-shorthand.md:41 -msgid "" -"Implement the `Default` trait for the struct. Define some fields and use the " -"default values for the other fields." -msgstr "" - -#: src/structs/field-shorthand.md:43 -msgid "" -"```rust,editable\n" -"#[derive(Debug)]\n" -"struct Person {\n" -" name: String,\n" -" age: u8,\n" -"}\n" -"impl Default for Person {\n" -" fn default() -> Person {\n" -" Person {\n" -" name: \"Bot\".to_string(),\n" -" age: 0,\n" -" }\n" -" }\n" -"}\n" -"fn create_default() {\n" -" let tmp = Person {\n" -" ..Default::default()\n" -" };\n" -" let tmp = Person {\n" -" name: \"Sam\".to_string(),\n" -" ..Default::default()\n" -" };\n" -"}\n" -"```" -msgstr "" - -#: src/structs/field-shorthand.md:68 -msgid "Methods are defined in the `impl` block." -msgstr "" - -#: src/structs/field-shorthand.md:69 -msgid "" -"Use struct update syntax to define a new structure using `peter`. Note that " -"the variable `peter` will no longer be accessible afterwards." -msgstr "" - -#: src/structs/field-shorthand.md:70 -msgid "" -"Use `{:#?}` when printing structs to request the `Debug` representation." -msgstr "" - #: src/enums.md:3 #, fuzzy msgid "" @@ -6507,7 +4946,7 @@ msgstr "" #, fuzzy msgid "" "This page offers an enum type `CoinFlip` with two variants `Heads` and " -"`Tail`. You might note the namespace when using variants." +"`Tails`. You might note the namespace when using variants." msgstr "" "Cette page propose un type d'énumération `CoinFlip` avec deux variantes " "`Heads` et `Tail`. Vous pouvez noter l'espace de noms lors de l'utilisation " @@ -6680,13 +5119,12 @@ msgstr "" #: src/enums/sizes.md:5 msgid "" "```rust,editable\n" +"use std::any::type_name;\n" "use std::mem::{align_of, size_of};\n" "\n" -"macro_rules! dbg_size {\n" -" ($t:ty) => {\n" -" println!(\"{}: size {} bytes, align: {} bytes\",\n" -" stringify!($t), size_of::<$t>(), align_of::<$t>());\n" -" };\n" +"fn dbg_size() {\n" +" println!(\"{}: size {} bytes, align: {} bytes\",\n" +" type_name::(), size_of::(), align_of::());\n" "}\n" "\n" "enum Foo {\n" @@ -6695,12 +5133,12 @@ msgid "" "}\n" "\n" "fn main() {\n" -" dbg_size!(Foo);\n" +" dbg_size::();\n" "}\n" "```" msgstr "" -#: src/enums/sizes.md:25 +#: src/enums/sizes.md:24 #, fuzzy msgid "" "See the [Rust Reference](https://doc.rust-lang.org/reference/type-layout." @@ -6709,18 +5147,18 @@ msgstr "" "Voir la [Rust Reference](https://doc.rust-lang.org/reference/type-layout." "html)." -#: src/enums/sizes.md:31 +#: src/enums/sizes.md:30 msgid "" "Internally Rust is using a field (discriminant) to keep track of the enum " "variant." msgstr "" -#: src/enums/sizes.md:33 +#: src/enums/sizes.md:32 msgid "" "You can control the discriminant if needed (e.g., for compatibility with C):" msgstr "" -#: src/enums/sizes.md:35 +#: src/enums/sizes.md:34 msgid "" "```rust,editable\n" "#[repr(u32)]\n" @@ -6738,57 +5176,57 @@ msgid "" "```" msgstr "" -#: src/enums/sizes.md:50 +#: src/enums/sizes.md:49 msgid "" "Without `repr`, the discriminant type takes 2 bytes, because 10001 fits 2 " "bytes." msgstr "" -#: src/enums/sizes.md:54 +#: src/enums/sizes.md:53 msgid "Try out other types such as" msgstr "" -#: src/enums/sizes.md:56 +#: src/enums/sizes.md:55 msgid "`dbg_size!(bool)`: size 1 bytes, align: 1 bytes," msgstr "" -#: src/enums/sizes.md:57 +#: src/enums/sizes.md:56 msgid "" "`dbg_size!(Option)`: size 1 bytes, align: 1 bytes (niche optimization, " "see below)," msgstr "" -#: src/enums/sizes.md:58 +#: src/enums/sizes.md:57 msgid "`dbg_size!(&i32)`: size 8 bytes, align: 8 bytes (on a 64-bit machine)," msgstr "" -#: src/enums/sizes.md:59 +#: src/enums/sizes.md:58 msgid "" "`dbg_size!(Option<&i32>)`: size 8 bytes, align: 8 bytes (null pointer " "optimization, see below)." msgstr "" -#: src/enums/sizes.md:61 +#: src/enums/sizes.md:60 msgid "" "Niche optimization: Rust will merge unused bit patterns for the enum " "discriminant." msgstr "" -#: src/enums/sizes.md:64 +#: src/enums/sizes.md:63 msgid "" "Null pointer optimization: For [some types](https://doc.rust-lang.org/std/" "option/#representation), Rust guarantees that `size_of::()` equals " "`size_of::>()`." msgstr "" -#: src/enums/sizes.md:68 +#: src/enums/sizes.md:67 msgid "" "Example code if you want to show how the bitwise representation _may_ look " "like in practice. It's important to note that the compiler provides no " "guarantees regarding this representation, therefore this is totally unsafe." msgstr "" -#: src/enums/sizes.md:71 +#: src/enums/sizes.md:70 msgid "" "```rust,editable\n" "use std::mem::transmute;\n" @@ -6827,13 +5265,13 @@ msgid "" "```" msgstr "" -#: src/enums/sizes.md:106 +#: src/enums/sizes.md:105 msgid "" "More complex example if you want to discuss what happens when we chain more " "than 256 `Option`s together." msgstr "" -#: src/enums/sizes.md:108 +#: src/enums/sizes.md:107 msgid "" "```rust,editable\n" "#![recursion_limit = \"1000\"]\n" @@ -6886,287 +5324,236 @@ msgid "" "```" msgstr "" -#: src/methods.md:3 -#, fuzzy +#: src/control-flow/novel.md:3 msgid "" -"Rust allows you to associate functions with your new types. You do this with " -"an `impl` block:" +"Rust has a few control flow constructs which differ from other languages. " +"They are used for pattern matching:" msgstr "" -"Rust vous permet d'associer des fonctions à vos nouveaux types. Vous faites " -"cela avec un Bloc `impl` :" -#: src/methods.md:6 +#: src/control-flow/novel.md:6 src/control-flow/if-let-expressions.md:1 +#, fuzzy +msgid "`if let` expressions" +msgstr "expressions `si nous allons`" + +#: src/control-flow/novel.md:7 +#, fuzzy +msgid "`while let` expressions" +msgstr "expressions `while let`" + +#: src/control-flow/novel.md:8 src/control-flow/match-expressions.md:1 +#, fuzzy +msgid "`match` expressions" +msgstr "expressions \"correspondantes\"" + +#: src/control-flow/if-let-expressions.md:3 +msgid "" +"The [`if let` expression](https://doc.rust-lang.org/reference/expressions/if-" +"expr.html#if-let-expressions) lets you execute different code depending on " +"whether a value matches a pattern:" +msgstr "" + +#: src/control-flow/if-let-expressions.md:7 msgid "" "```rust,editable\n" -"#[derive(Debug)]\n" -"struct Person {\n" -" name: String,\n" -" age: u8,\n" -"}\n" -"\n" -"impl Person {\n" -" fn say_hello(&self) {\n" -" println!(\"Hello, my name is {}\", self.name);\n" +"fn main() {\n" +" let arg = std::env::args().next();\n" +" if let Some(value) = arg {\n" +" println!(\"Program name: {value}\");\n" +" } else {\n" +" println!(\"Missing name?\");\n" " }\n" "}\n" -"\n" +"```" +msgstr "" + +#: src/control-flow/if-let-expressions.md:18 +#: src/control-flow/while-let-expressions.md:21 +#: src/control-flow/match-expressions.md:23 +#, fuzzy +msgid "" +"See [pattern matching](../pattern-matching.md) for more details on patterns " +"in Rust." +msgstr "" +"Voir [pattern matching](../pattern-matching.md) pour plus de détails sur les " +"modèles dans Rouiller." + +#: src/control-flow/if-let-expressions.md:23 +msgid "" +"Unlike `match`, `if let` does not have to cover all branches. This can make " +"it more concise than `match`." +msgstr "" + +#: src/control-flow/if-let-expressions.md:24 +msgid "A common usage is handling `Some` values when working with `Option`." +msgstr "" + +#: src/control-flow/if-let-expressions.md:25 +msgid "" +"Unlike `match`, `if let` does not support guard clauses for pattern matching." +msgstr "" + +#: src/control-flow/if-let-expressions.md:26 +msgid "" +"Since 1.65, a similar [let-else](https://doc.rust-lang.org/rust-by-example/" +"flow_control/let_else.html) construct allows to do a destructuring " +"assignment, or if it fails, execute a block which is required to abort " +"normal control flow (with `panic`/`return`/`break`/`continue`):" +msgstr "" + +#: src/control-flow/if-let-expressions.md:28 +msgid "" +"```rust,editable\n" "fn main() {\n" -" let peter = Person {\n" -" name: String::from(\"Peter\"),\n" -" age: 27,\n" +" println!(\"{:?}\", second_word_to_upper(\"foo bar\"));\n" +"}\n" +" \n" +"fn second_word_to_upper(s: &str) -> Option {\n" +" let mut it = s.split(' ');\n" +" let (Some(_), Some(item)) = (it.next(), it.next()) else {\n" +" return None;\n" " };\n" -" peter.say_hello();\n" +" Some(item.to_uppercase())\n" "}\n" +"\n" "```" msgstr "" -#: src/methods.md:31 +#: src/control-flow/while-let-expressions.md:1 #, fuzzy -msgid "It can be helpful to introduce methods by comparing them to functions." -msgstr "" -"Il peut être utile d'introduire des méthodes en les comparant à des " -"fonctions." +msgid "`while let` loops" +msgstr "expressions `while let`" -#: src/methods.md:32 +#: src/control-flow/while-let-expressions.md:3 #, fuzzy msgid "" -"Methods are called on an instance of a type (such as a struct or enum), the " -"first parameter represents the instance as `self`." +"Like with `if let`, there is a [`while let`](https://doc.rust-lang.org/" +"reference/expressions/loop-expr.html#predicate-pattern-loops) variant which " +"repeatedly tests a value against a pattern:" msgstr "" -"Les méthodes sont appelées sur une instance d'un type (tel qu'un struct ou " -"un enum), le premier paramètre représente l'instance en tant que \"self\"." +"Comme avec `if`, il existe une variante `while let` qui teste à plusieurs " +"reprises une valeur contre un modèle :" -#: src/methods.md:33 -#, fuzzy -msgid "" -"Developers may choose to use methods to take advantage of method receiver " -"syntax and to help keep them more organized. By using methods we can keep " -"all the implementation code in one predictable place." -msgstr "" -"Les développeurs peuvent choisir d'utiliser des méthodes pour tirer parti de " -"la syntaxe du récepteur de méthode et pour mieux les organiser. En utilisant " -"des méthodes, nous pouvons conserver tout le code d'implémentation en un " -"seul endroit prévisible." - -#: src/methods.md:34 -#, fuzzy -msgid "Point out the use of the keyword `self`, a method receiver. " -msgstr "Soulignez l'utilisation du mot-clé `self`, un récepteur de méthode." - -#: src/methods.md:35 -#, fuzzy -msgid "" -"Show that it is an abbreviated term for `self:&Self` and perhaps show how " -"the struct name could also be used. " -msgstr "" -"Montrez qu'il s'agit d'un terme abrégé pour `self:&Self` et montrez peut-" -"être comment le nom de la structure pourrait également être utilisé." - -#: src/methods.md:36 -#, fuzzy -msgid "" -"Explain that `Self` is a type alias for the type the `impl` block is in and " -"can be used elsewhere in the block." -msgstr "" -"Expliquez que `Self` est un alias de type pour le type dans lequel se trouve " -"le bloc `impl` et peut être utilisé ailleurs dans le bloc." - -#: src/methods.md:37 -#, fuzzy -msgid "" -"Note how `self` is used like other structs and dot notation can be used to " -"refer to individual fields." -msgstr "" -"Notez comment `self` est utilisé comme d'autres structures et la notation " -"par points peut être utilisée pour faire référence à des champs individuels." - -#: src/methods.md:38 -#, fuzzy -msgid "" -"This might be a good time to demonstrate how the `&self` differs from `self` " -"by modifying the code and trying to run say_hello twice." -msgstr "" -"C'est peut-être le bon moment pour démontrer en quoi `&self` diffère de " -"`self` en modifiant le code et en essayant d'exécuter say_hello deux fois." - -#: src/methods.md:39 -#, fuzzy -msgid "We describe the distinction between method receivers next." -msgstr "Nous décrivons ensuite la distinction entre les récepteurs de méthode." - -#: src/methods/receiver.md:3 -#, fuzzy -msgid "" -"The `&self` above indicates that the method borrows the object immutably. " -"There are other possible receivers for a method:" -msgstr "" -"Le `&self` ci-dessus indique que la méthode emprunte l'objet de manière " -"immuable. Là sont d'autres récepteurs possibles pour une méthode :" - -#: src/methods/receiver.md:6 -#, fuzzy -msgid "" -"`&self`: borrows the object from the caller using a shared and immutable " -"reference. The object can be used again afterwards." -msgstr "" -"`&self` : emprunte l'objet à l'appelant en utilisant un partage et immuable " -"référence. L'objet peut être réutilisé par la suite." - -#: src/methods/receiver.md:8 -#, fuzzy -msgid "" -"`&mut self`: borrows the object from the caller using a unique and mutable " -"reference. The object can be used again afterwards." -msgstr "" -"`&mut self` : emprunte l'objet à l'appelant en utilisant un nom unique et " -"mutable référence. L'objet peut être réutilisé par la suite." - -#: src/methods/receiver.md:10 -#, fuzzy -msgid "" -"`self`: takes ownership of the object and moves it away from the caller. The " -"method becomes the owner of the object. The object will be dropped " -"(deallocated) when the method returns, unless its ownership is explicitly " -"transmitted. Complete ownership does not automatically mean mutability." -msgstr "" -"`self` : prend possession de l'objet et l'éloigne de l'appelant. Le méthode " -"devient le propriétaire de l'objet. L'objet sera supprimé (désalloué) " -"lorsque la méthode revient, sauf si sa propriété est explicitement transmis." - -#: src/methods/receiver.md:14 -#, fuzzy -msgid "`mut self`: same as above, but the method can mutate the object. " -msgstr "" -"`mut self` : comme ci-dessus, mais tant que la méthode possède l'objet, elle " -"peut le faire muter aussi. La propriété complète ne signifie pas " -"automatiquement la mutabilité." - -#: src/methods/receiver.md:15 -#, fuzzy -msgid "" -"No receiver: this becomes a static method on the struct. Typically used to " -"create constructors which are called `new` by convention." -msgstr "" -"Pas de récepteur : cela devient une méthode statique sur la structure. " -"Généralement utilisé pour créer des constructeurs appelés \"nouveaux\" par " -"convention." - -#: src/methods/receiver.md:18 -#, fuzzy -msgid "" -"Beyond variants on `self`, there are also [special wrapper types](https://" -"doc.rust-lang.org/reference/special-types-and-traits.html) allowed to be " -"receiver types, such as `Box`." -msgstr "" -"Au-delà des variantes sur \"self\", il y a aussi \\[types d'emballage " -"spéciaux\\] (https://doc.rust-lang.org/reference/special-types-and-traits." -"html) autorisés à être des types de récepteurs, tels que `Box`." - -#: src/methods/receiver.md:24 -#, fuzzy -msgid "" -"Consider emphasizing \"shared and immutable\" and \"unique and mutable\". " -"These constraints always come together in Rust due to borrow checker rules, " -"and `self` is no exception. It isn't possible to reference a struct from " -"multiple locations and call a mutating (`&mut self`) method on it." -msgstr "" -"Pensez à mettre l'accent sur \"partagé et immuable\" et \"unique et " -"modifiable\". Ces contraintes viennent toujours ensemble dans Rust en raison " -"des règles du vérificateur d'emprunt, et \"self\" ne fait pas exception. Il " -"n'est pas possible de référencez une structure à partir de plusieurs " -"emplacements et appelez une méthode de mutation (`&mut self`) sur celle-ci." - -#: src/methods/example.md:3 +#: src/control-flow/while-let-expressions.md:6 msgid "" "```rust,editable\n" -"#[derive(Debug)]\n" -"struct Race {\n" -" name: String,\n" -" laps: Vec,\n" -"}\n" -"\n" -"impl Race {\n" -" fn new(name: &str) -> Race { // No receiver, a static method\n" -" Race { name: String::from(name), laps: Vec::new() }\n" -" }\n" -"\n" -" fn add_lap(&mut self, lap: i32) { // Exclusive borrowed read-write " -"access to self\n" -" self.laps.push(lap);\n" -" }\n" -"\n" -" fn print_laps(&self) { // Shared and read-only borrowed access to self\n" -" println!(\"Recorded {} laps for {}:\", self.laps.len(), self.name);\n" -" for (idx, lap) in self.laps.iter().enumerate() {\n" -" println!(\"Lap {idx}: {lap} sec\");\n" -" }\n" -" }\n" -"\n" -" fn finish(self) { // Exclusive ownership of self\n" -" let total = self.laps.iter().sum::();\n" -" println!(\"Race {} is finished, total lap time: {}\", self.name, " -"total);\n" -" }\n" -"}\n" -"\n" "fn main() {\n" -" let mut race = Race::new(\"Monaco Grand Prix\");\n" -" race.add_lap(70);\n" -" race.add_lap(68);\n" -" race.print_laps();\n" -" race.add_lap(71);\n" -" race.print_laps();\n" -" race.finish();\n" -" // race.add_lap(42);\n" +" let v = vec![10, 20, 30];\n" +" let mut iter = v.into_iter();\n" +"\n" +" while let Some(x) = iter.next() {\n" +" println!(\"x: {x}\");\n" +" }\n" "}\n" "```" msgstr "" -#: src/methods/example.md:47 -#, fuzzy -msgid "All four methods here use a different method receiver." -msgstr "Les quatre méthodes ici utilisent un récepteur de méthode différent." - -#: src/methods/example.md:48 +#: src/control-flow/while-let-expressions.md:17 #, fuzzy msgid "" -"You can point out how that changes what the function can do with the " -"variable values and if/how it can be used again in `main`." +"Here the iterator returned by `v.into_iter()` will return a `Option` on " +"every call to `next()`. It returns `Some(x)` until it is done, after which " +"it will return `None`. The `while let` lets us keep iterating through all " +"items." msgstr "" -"Vous pouvez indiquer comment cela change ce que la fonction peut faire avec " -"les valeurs des variables et si/comment elle peut être réutilisée dans " -"`main`." +"Ici, l'itérateur renvoyé par `v.iter()` renverra une `Option` à chaque " +"appel à `next()`. Il renvoie `Some(x)` jusqu'à ce qu'il soit terminé, après " +"quoi il renvoie \"Aucun\". Le `while let` nous permet de continuer à " +"parcourir tous les éléments." -#: src/methods/example.md:49 +#: src/control-flow/while-let-expressions.md:26 #, fuzzy msgid "" -"You can showcase the error that appears when trying to call `finish` twice." +"Point out that the `while let` loop will keep going as long as the value " +"matches the pattern." msgstr "" -"Vous pouvez afficher l'erreur qui apparaît lorsque vous essayez d'appeler " -"\"finish\" deux fois." +"Soulignez que la boucle `while let` continuera tant que la valeur correspond " +"au modèle." -#: src/methods/example.md:50 +#: src/control-flow/while-let-expressions.md:27 #, fuzzy msgid "" -"Note that although the method receivers are different, the non-static " -"functions are called the same way in the main body. Rust enables automatic " -"referencing and dereferencing when calling methods. Rust automatically adds " -"in the `&`, `*`, `muts` so that that object matches the method signature." +"You could rewrite the `while let` loop as an infinite loop with an if " +"statement that breaks when there is no value to unwrap for `iter.next()`. " +"The `while let` provides syntactic sugar for the above scenario." msgstr "" -"Notez que bien que les récepteurs de méthode soient différents, les " -"fonctions non statiques sont appelées de la même manière dans le corps " -"principal. Rust permet le référencement et le déréférencement automatique " -"lors de l'appel de méthodes. Rust ajoute automatiquement les `&`, `*`, " -"`muts` afin que cet objet corresponde à la signature de la méthode." +"Vous pouvez réécrire la boucle `while let` comme une boucle infinie avec une " +"instruction if qui s'interrompt lorsqu'il n'y a pas de valeur à déballer " +"pour `iter.next()`. Le `while let` fournit du sucre syntaxique pour le " +"scénario ci-dessus." -#: src/methods/example.md:51 +#: src/control-flow/match-expressions.md:3 #, fuzzy msgid "" -"You might point out that `print_laps` is using a vector that is iterated " -"over. We describe vectors in more detail in the afternoon. " +"The [`match` keyword](https://doc.rust-lang.org/reference/expressions/match-" +"expr.html) is used to match a value against one or more patterns. In that " +"sense, it works like a series of `if let` expressions:" msgstr "" -"Vous pourriez remarquer que `print_laps` utilise un vecteur qui est itéré. " -"Nous décrivons les vecteurs plus en détail dans l'après-midi." +"Le mot clé `match` est utilisé pour faire correspondre une valeur à un ou " +"plusieurs modèles. Dans en ce sens, cela fonctionne comme une série " +"d'expressions \"if let\":" + +#: src/control-flow/match-expressions.md:7 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" match std::env::args().next().as_deref() {\n" +" Some(\"cat\") => println!(\"Will do cat things\"),\n" +" Some(\"ls\") => println!(\"Will ls some files\"),\n" +" Some(\"mv\") => println!(\"Let's move some files\"),\n" +" Some(\"rm\") => println!(\"Uh, dangerous!\"),\n" +" None => println!(\"Hmm, no program name?\"),\n" +" _ => println!(\"Unknown program name!\"),\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/control-flow/match-expressions.md:20 +#, fuzzy +msgid "" +"Like `if let`, each match arm must have the same type. The type is the last " +"expression of the block, if any. In the example above, the type is `()`." +msgstr "" +"Comme `if let`, chaque bras de correspondance doit avoir le même type. Le " +"type est le dernier expression du bloc, le cas échéant. Dans l'exemple ci-" +"dessus, le type est `()`." + +#: src/control-flow/match-expressions.md:28 +#, fuzzy +msgid "Save the match expression to a variable and print it out." +msgstr "" +"Enregistrez l'expression de correspondance dans une variable et imprimez-la." + +#: src/control-flow/match-expressions.md:29 +#, fuzzy +msgid "Remove `.as_deref()` and explain the error." +msgstr "Supprimez `.as_deref()` et expliquez l'erreur." + +#: src/control-flow/match-expressions.md:30 +#, fuzzy +msgid "" +"`std::env::args().next()` returns an `Option`, but we cannot match " +"against `String`." +msgstr "" +"`std::env::args().next()` renvoie une `Option`, mais nous ne pouvons " +"pas comparer `String`." + +#: src/control-flow/match-expressions.md:31 +#, fuzzy +msgid "" +"`as_deref()` transforms an `Option` to `Option<&T::Target>`. In our case, " +"this turns `Option` into `Option<&str>`." +msgstr "" +"`as_deref()` transforme une `Option` en `Option<&T::Target>`. Dans notre " +"cas, cela transforme `Option` en `Option<&str>`." + +#: src/control-flow/match-expressions.md:32 +#, fuzzy +msgid "" +"We can now use pattern matching to match against the `&str` inside `Option`." +msgstr "" +"Nous pouvons maintenant utiliser le pattern matching pour faire correspondre " +"le `&str` à l'intérieur de `Option`." #: src/pattern-matching.md:3 #, fuzzy @@ -7507,6 +5894,2027 @@ msgstr "" "La condition définie dans la garde s'applique à chaque expression dans un " "modèle avec un `|`." +#: src/exercises/day-1/afternoon.md:1 +#, fuzzy +msgid "Day 1: Afternoon Exercises" +msgstr "Jour 1 : Exercices de l'après-midi" + +#: src/exercises/day-1/afternoon.md:3 +#, fuzzy +msgid "We will look at two things:" +msgstr "Nous allons regarder deux choses :" + +#: src/exercises/day-1/afternoon.md:5 +#, fuzzy +msgid "The Luhn algorithm," +msgstr "Algorithme de Luhn" + +#: src/exercises/day-1/afternoon.md:7 +#, fuzzy +msgid "An exercise on pattern matching." +msgstr "Énumérations et correspondance de modèles." + +#: src/exercises/day-1/afternoon.md:11 src/exercises/day-2/afternoon.md:7 +#: src/exercises/bare-metal/afternoon.md:7 +#: src/exercises/concurrency/afternoon.md:13 +#, fuzzy +msgid "" +"After looking at the exercises, you can look at the [solutions](solutions-" +"afternoon.md) provided." +msgstr "" +"Après avoir regardé l'exercice, vous pouvez regarder la [solution](solutions-" +"afternoon.md) fournie." + +#: src/exercises/day-1/luhn.md:3 +#, fuzzy +msgid "" +"The [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) is used " +"to validate credit card numbers. The algorithm takes a string as input and " +"does the following to validate the credit card number:" +msgstr "" +"L'[algorithme de Luhn](https://en.wikipedia.org/wiki/Luhn_algorithm) est " +"utilisé pour valider les numéros de carte de crédit. L'algorithme prend une " +"chaîne en entrée et fait le suivant pour valider le numéro de carte " +"bancaire :" + +#: src/exercises/day-1/luhn.md:7 +#, fuzzy +msgid "Ignore all spaces. Reject number with less than two digits." +msgstr "" +"Ignorer tous les espaces. Numéro de rejet comportant moins de deux chiffres." + +#: src/exercises/day-1/luhn.md:9 +#, fuzzy +msgid "" +"Moving from **right to left**, double every second digit: for the number " +"`1234`, we double `3` and `1`. For the number `98765`, we double `6` and `8`." +msgstr "" +"En se déplaçant de droite à gauche, doubler tous les deux chiffres : pour le " +"nombre `1234`, on double '3' et '1'." + +#: src/exercises/day-1/luhn.md:12 +#, fuzzy +msgid "" +"After doubling a digit, sum the digits. So doubling `7` becomes `14` which " +"becomes `5`." +msgstr "" +"Après avoir doublé un chiffre, additionnez les chiffres. Donc doubler '7' " +"devient '14' ce qui devient '5'." + +#: src/exercises/day-1/luhn.md:15 +#, fuzzy +msgid "Sum all the undoubled and doubled digits." +msgstr "Additionnez tous les chiffres non doublés et doublés." + +#: src/exercises/day-1/luhn.md:17 +#, fuzzy +msgid "The credit card number is valid if the sum ends with `0`." +msgstr "" +"Le numéro de carte de crédit est valide si la somme se termine par '0'." + +#: src/exercises/day-1/luhn.md:19 +#, fuzzy +msgid "" +"Copy the code below to and implement the " +"function." +msgstr "" +"Copiez le code ci-dessous sur et implémentez " +"le les fonctions:" + +#: src/exercises/day-1/luhn.md:21 +msgid "" +"Try to solve the problem the \"simple\" way first, using `for` loops and " +"integers. Then, revisit the solution and try to implement it with iterators." +msgstr "" + +#: src/exercises/day-1/luhn.md:25 +msgid "" +"```rust\n" +"// TODO: remove this when you're done with your implementation.\n" +"#![allow(unused_variables, dead_code)]\n" +"\n" +"pub fn luhn(cc_number: &str) -> bool {\n" +" unimplemented!()\n" +"}\n" +"\n" +"#[test]\n" +"fn test_non_digit_cc_number() {\n" +" assert!(!luhn(\"foo\"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_empty_cc_number() {\n" +" assert!(!luhn(\"\"));\n" +" assert!(!luhn(\" \"));\n" +" assert!(!luhn(\" \"));\n" +" assert!(!luhn(\" \"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_single_digit_cc_number() {\n" +" assert!(!luhn(\"0\"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_two_digit_cc_number() {\n" +" assert!(luhn(\" 0 0 \"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_valid_cc_number() {\n" +" assert!(luhn(\"4263 9826 4026 9299\"));\n" +" assert!(luhn(\"4539 3195 0343 6467\"));\n" +" assert!(luhn(\"7992 7398 713\"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_invalid_cc_number() {\n" +" assert!(!luhn(\"4223 9826 4026 9299\"));\n" +" assert!(!luhn(\"4539 3195 0343 6476\"));\n" +" assert!(!luhn(\"8273 1232 7352 0569\"));\n" +"}\n" +"\n" +"#[allow(dead_code)]\n" +"fn main() {}\n" +"```" +msgstr "" + +#: src/welcome-day-2.md:1 +#, fuzzy +msgid "Welcome to Day 2" +msgstr "Bienvenue au jour 2" + +#: src/welcome-day-2.md:3 +#, fuzzy +msgid "Now that we have seen a fair amount of Rust, we will continue with:" +msgstr "" +"Maintenant que nous avons vu une bonne quantité de Rust, nous allons " +"continuer avec :" + +#: src/welcome-day-2.md:5 +msgid "" +"Memory management: stack vs heap, manual memory management, scope-based " +"memory management, and garbage collection." +msgstr "" +"Gestion de la mémoire : pile contre tas, gestion manuelle de la mémoire, " +"gestion de la mémoire basée sur la portée et le ramassage des ordures." + +#: src/welcome-day-2.md:8 +msgid "" +"Ownership: move semantics, copying and cloning, borrowing, and lifetimes." +msgstr "" +"Propriété : sémantique de déplacement, copie et clonage, emprunt et durée de " +"vie." + +#: src/welcome-day-2.md:10 +#, fuzzy +msgid "Structs and methods." +msgstr "Structures, énumérations, méthodes." + +#: src/welcome-day-2.md:12 +#, fuzzy +msgid "" +"The Standard Library: `String`, `Option` and `Result`, `Vec`, `HashMap`, " +"`Rc` and `Arc`." +msgstr "" +"La bibliothèque standard : `String`, `Option` et `Result`, `Vec`, `HashMap`, " +"`Rc` et \"Arc\"." + +#: src/welcome-day-2.md:15 +#, fuzzy +msgid "Modules: visibility, paths, and filesystem hierarchy." +msgstr "Modules : visibilité, chemins et hiérarchie du système de fichiers." + +#: src/memory-management.md:3 +#, fuzzy +msgid "Traditionally, languages have fallen into two broad categories:" +msgstr "" +"Traditionnellement, les langues se répartissent en deux grandes catégories :" + +#: src/memory-management.md:5 +#, fuzzy +msgid "Full control via manual memory management: C, C++, Pascal, ..." +msgstr "" +"Contrôle total via la gestion manuelle de la mémoire : C, C++, Pascal, ..." + +#: src/memory-management.md:6 +#, fuzzy +msgid "" +"Full safety via automatic memory management at runtime: Java, Python, Go, " +"Haskell, ..." +msgstr "" +"Sécurité totale via la gestion automatique de la mémoire à l'exécution : " +"Java, Python, Go, Haskell, ..." + +#: src/memory-management.md:8 +#, fuzzy +msgid "Rust offers a new mix:" +msgstr "Rust propose un nouveau mix :" + +#: src/memory-management.md:10 +#, fuzzy +msgid "" +"Full control _and_ safety via compile time enforcement of correct memory " +"management." +msgstr "" +"Contrôle total * et * sécurité via l'application du temps de compilation de " +"la mémoire correcte gestion." + +#: src/memory-management.md:13 +#, fuzzy +msgid "It does this with an explicit ownership concept." +msgstr "Il le fait avec un concept de propriété explicite." + +#: src/memory-management.md:15 +#, fuzzy +msgid "First, let's refresh how memory management works." +msgstr "" +"Tout d'abord, rafraîchissons le fonctionnement de la gestion de la mémoire." + +#: src/memory-management/stack-vs-heap.md:1 +#, fuzzy +msgid "The Stack vs The Heap" +msgstr "La pile contre le tas" + +#: src/memory-management/stack-vs-heap.md:3 +#, fuzzy +msgid "Stack: Continuous area of memory for local variables." +msgstr "Pile : Zone continue de mémoire pour les variables locales." + +#: src/memory-management/stack-vs-heap.md:4 +#, fuzzy +msgid "Values have fixed sizes known at compile time." +msgstr "Les valeurs ont des tailles fixes connues au moment de la compilation." + +#: src/memory-management/stack-vs-heap.md:5 +#, fuzzy +msgid "Extremely fast: just move a stack pointer." +msgstr "Extrêmement rapide : il suffit de déplacer un pointeur de pile." + +#: src/memory-management/stack-vs-heap.md:6 +#, fuzzy +msgid "Easy to manage: follows function calls." +msgstr "Facile à gérer : suit les appels de fonction." + +#: src/memory-management/stack-vs-heap.md:7 +#, fuzzy +msgid "Great memory locality." +msgstr "Grande localité de mémoire." + +#: src/memory-management/stack-vs-heap.md:9 +#, fuzzy +msgid "Heap: Storage of values outside of function calls." +msgstr "Heap : Stockage de valeurs en dehors des appels de fonction." + +#: src/memory-management/stack-vs-heap.md:10 +#, fuzzy +msgid "Values have dynamic sizes determined at runtime." +msgstr "" +"Les valeurs ont des tailles dynamiques déterminées au moment de l'exécution." + +#: src/memory-management/stack-vs-heap.md:11 +#, fuzzy +msgid "Slightly slower than the stack: some book-keeping needed." +msgstr "" +"Légèrement plus lent que la pile : une certaine comptabilité est nécessaire." + +#: src/memory-management/stack-vs-heap.md:12 +#, fuzzy +msgid "No guarantee of memory locality." +msgstr "Aucune garantie de localisation de la mémoire." + +#: src/memory-management/stack.md:1 +#, fuzzy +msgid "Stack and Heap Example" +msgstr "Pile et Tas" + +#: src/memory-management/stack.md:3 +#, fuzzy +msgid "" +"Creating a `String` puts fixed-sized metadata on the stack and dynamically " +"sized data, the actual string, on the heap:" +msgstr "" +"La création d'une \"chaîne\" place des données de taille fixe sur la pile et " +"dimensionnées dynamiquement données sur le tas :" + +#: src/memory-management/stack.md:6 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let s1 = String::from(\"Hello\");\n" +"}\n" +"```" +msgstr "" + +#: src/memory-management/stack.md:12 +msgid "" +"```bob\n" +" Stack Heap\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - -.\n" +": : : :\n" +": s1 : : :\n" +": +-----------+-------+ : : +----+----+----+----+----+ :\n" +": | ptr | o---+---+-----+-->| H | e | l | l | o | :\n" +": | len | 5 | : : +----+----+----+----+----+ :\n" +": | capacity | 5 | : : :\n" +": +-----------+-------+ : : :\n" +": : `- - - - - - - - - - - - - - - -'\n" +"`- - - - - - - - - - - - - -'\n" +"```" +msgstr "" + +#: src/memory-management/stack.md:28 +msgid "" +"Mention that a `String` is backed by a `Vec`, so it has a capacity and " +"length and can grow if mutable via reallocation on the heap." +msgstr "" + +#: src/memory-management/stack.md:30 +msgid "" +"If students ask about it, you can mention that the underlying memory is heap " +"allocated using the [System Allocator](https://doc.rust-lang.org/std/alloc/" +"struct.System.html) and custom allocators can be implemented using the " +"[Allocator API](https://doc.rust-lang.org/std/alloc/index.html)" +msgstr "" + +#: src/memory-management/stack.md:32 +msgid "" +"We can inspect the memory layout with `unsafe` code. However, you should " +"point out that this is rightfully unsafe!" +msgstr "" + +#: src/memory-management/stack.md:34 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let mut s1 = String::from(\"Hello\");\n" +" s1.push(' ');\n" +" s1.push_str(\"world\");\n" +" // DON'T DO THIS AT HOME! For educational purposes only.\n" +" // String provides no guarantees about its layout, so this could lead " +"to\n" +" // undefined behavior.\n" +" unsafe {\n" +" let (ptr, capacity, len): (usize, usize, usize) = std::mem::" +"transmute(s1);\n" +" println!(\"ptr = {ptr:#x}, len = {len}, capacity = {capacity}\");\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/memory-management/manual.md:3 +#, fuzzy +msgid "You allocate and deallocate heap memory yourself." +msgstr "Vous allouez et désallouez vous-même la mémoire de tas." + +#: src/memory-management/manual.md:5 +#, fuzzy +msgid "" +"If not done with care, this can lead to crashes, bugs, security " +"vulnerabilities, and memory leaks." +msgstr "" +"Si cela n'est pas fait avec soin, cela peut entraîner des plantages, des " +"bogues, des failles de sécurité et des fuites de mémoire." + +#: src/memory-management/manual.md:7 +#, fuzzy +msgid "C Example" +msgstr "C Exemple" + +#: src/memory-management/manual.md:9 +#, fuzzy +msgid "You must call `free` on every pointer you allocate with `malloc`:" +msgstr "" +"Vous devez appeler `free` sur chaque pointeur que vous allouez avec " +"`malloc` :" + +#: src/memory-management/manual.md:11 +msgid "" +"```c\n" +"void foo(size_t n) {\n" +" int* int_array = malloc(n * sizeof(int));\n" +" //\n" +" // ... lots of code\n" +" //\n" +" free(int_array);\n" +"}\n" +"```" +msgstr "" + +#: src/memory-management/manual.md:21 +#, fuzzy +msgid "" +"Memory is leaked if the function returns early between `malloc` and `free`: " +"the pointer is lost and we cannot deallocate the memory. Worse, freeing the " +"pointer twice, or accessing a freed pointer can lead to exploitable security " +"vulnerabilities." +msgstr "" +"La mémoire est perdue si la fonction revient tôt entre `malloc` et `free` : " +"le pointeur est perdu et nous ne pouvons pas désallouer la mémoire." + +#: src/memory-management/scope-based.md:3 +#, fuzzy +msgid "" +"Constructors and destructors let you hook into the lifetime of an object." +msgstr "" +"Les constructeurs et les destructeurs vous permettent de vous connecter à la " +"durée de vie d'un objet." + +#: src/memory-management/scope-based.md:5 +#, fuzzy +msgid "" +"By wrapping a pointer in an object, you can free memory when the object is " +"destroyed. The compiler guarantees that this happens, even if an exception " +"is raised." +msgstr "" +"En enveloppant un pointeur dans un objet, vous pouvez libérer de la mémoire " +"lorsque l'objet est détruit. Le compilateur garantit que cela se produit, " +"même si une exception est soulevé." + +#: src/memory-management/scope-based.md:9 +#, fuzzy +msgid "" +"This is often called _resource acquisition is initialization_ (RAII) and " +"gives you smart pointers." +msgstr "" +"Ceci est souvent appelé _l'acquisition de ressources est initialisée_ (RAII) " +"et donne vous pointeurs intelligents." + +#: src/memory-management/scope-based.md:12 +#, fuzzy +msgid "C++ Example" +msgstr "Exemple C++" + +#: src/memory-management/scope-based.md:14 +msgid "" +"```c++\n" +"void say_hello(std::unique_ptr person) {\n" +" std::cout << \"Hello \" << person->name << std::endl;\n" +"}\n" +"```" +msgstr "" + +#: src/memory-management/scope-based.md:20 +#, fuzzy +msgid "" +"The `std::unique_ptr` object is allocated on the stack, and points to memory " +"allocated on the heap." +msgstr "" +"L'objet `std::unique_ptr` est alloué sur la pile et pointe vers mémoire " +"allouée sur le tas." + +#: src/memory-management/scope-based.md:22 +#, fuzzy +msgid "At the end of `say_hello`, the `std::unique_ptr` destructor will run." +msgstr "À la fin de `say_hello`, le destructeur `std::unique_ptr` s'exécutera." + +#: src/memory-management/scope-based.md:23 +#, fuzzy +msgid "The destructor frees the `Person` object it points to." +msgstr "Le destructeur libère l'objet `Person` vers lequel il pointe." + +#: src/memory-management/scope-based.md:25 +#, fuzzy +msgid "" +"Special move constructors are used when passing ownership to a function:" +msgstr "" +"Des constructeurs de mouvement spéciaux sont utilisés lors du transfert de " +"propriété à une fonction :" + +#: src/memory-management/scope-based.md:27 +msgid "" +"```c++\n" +"std::unique_ptr person = find_person(\"Carla\");\n" +"say_hello(std::move(person));\n" +"```" +msgstr "" + +#: src/memory-management/garbage-collection.md:1 +#, fuzzy +msgid "Automatic Memory Management" +msgstr "Gestion automatique de la mémoire" + +#: src/memory-management/garbage-collection.md:3 +#, fuzzy +msgid "" +"An alternative to manual and scope-based memory management is automatic " +"memory management:" +msgstr "" +"Une alternative à la gestion manuelle et basée sur la portée de la mémoire " +"est la mémoire automatique gestion:" + +#: src/memory-management/garbage-collection.md:6 +#, fuzzy +msgid "The programmer never allocates or deallocates memory explicitly." +msgstr "Le programmeur n'alloue ou ne libère jamais de mémoire explicitement." + +#: src/memory-management/garbage-collection.md:7 +#, fuzzy +msgid "" +"A garbage collector finds unused memory and deallocates it for the " +"programmer." +msgstr "" +"Un ramasse-miettes trouve la mémoire inutilisée et la libère pour le " +"programmeur." + +#: src/memory-management/garbage-collection.md:9 +#, fuzzy +msgid "Java Example" +msgstr "Exemple Java" + +#: src/memory-management/garbage-collection.md:11 +#, fuzzy +msgid "The `person` object is not deallocated after `sayHello` returns:" +msgstr "L'objet `person` n'est pas désalloué après le retour de `sayHello` :" + +#: src/memory-management/garbage-collection.md:13 +msgid "" +"```java\n" +"void sayHello(Person person) {\n" +" System.out.println(\"Hello \" + person.getName());\n" +"}\n" +"```" +msgstr "" + +#: src/memory-management/rust.md:1 +#, fuzzy +msgid "Memory Management in Rust" +msgstr "Gestion de la mémoire avec Rust" + +#: src/memory-management/rust.md:3 +#, fuzzy +msgid "Memory management in Rust is a mix:" +msgstr "La gestion de la mémoire avec Rust est un mélange :" + +#: src/memory-management/rust.md:5 +#, fuzzy +msgid "Safe and correct like Java, but without a garbage collector." +msgstr "Sûr et correct comme Java, mais sans ramasse-miettes." + +#: src/memory-management/rust.md:6 +#, fuzzy +msgid "Scope-based like C++, but the compiler enforces full adherence." +msgstr "" +"Basé sur la portée comme C++, mais le compilateur applique une adhésion " +"totale." + +#: src/memory-management/rust.md:7 +#, fuzzy +msgid "" +"A Rust user can choose the right abstraction for the situation, some even " +"have no cost at runtime like C." +msgstr "" +"Un utilisateur de Rust peut choisir la bonne abstraction pour la situation, " +"certains n'ont même aucun coût à l'exécution comme C." + +#: src/memory-management/rust.md:9 +#, fuzzy +msgid "Rust achieves this by modeling _ownership_ explicitly." +msgstr "Il y parvient en modélisant explicitement _ownership_." + +#: src/memory-management/rust.md:13 +#, fuzzy +msgid "" +"If asked how at this point, you can mention that in Rust this is usually " +"handled by RAII wrapper types such as [Box](https://doc.rust-lang.org/std/" +"boxed/struct.Box.html), [Vec](https://doc.rust-lang.org/std/vec/struct.Vec." +"html), [Rc](https://doc.rust-lang.org/std/rc/struct.Rc.html), or [Arc]" +"(https://doc.rust-lang.org/std/sync/struct.Arc.html). These encapsulate " +"ownership and memory allocation via various means, and prevent the potential " +"errors in C." +msgstr "" +"Si on vous demande comment à ce stade, vous pouvez mentionner qu'avec Rust, " +"cela est généralement géré par des types de wrapper RAII tels que [Box]" +"(https://doc.rust-lang.org/std/boxed/struct.Box.html), [Vec](https://doc." +"rust-lang.org/std/vec/struct.Vec.html), [Rc](https://doc.rust-lang.org/std/" +"rc/struct.Rc.html) ou [Arc](https://doc.rust-lang.org/std/sync/struct.Arc." +"html). Ceux-ci encapsulent la propriété et l'allocation de mémoire par " +"divers moyens et empêchent les erreurs potentielles dans C." + +#: src/memory-management/rust.md:15 +#, fuzzy +msgid "" +"You may be asked about destructors here, the [Drop](https://doc.rust-lang." +"org/std/ops/trait.Drop.html) trait is the Rust equivalent." +msgstr "" +"Vous pouvez être interrogé sur les destructeurs ici, le trait [Drop](https://" +"doc.rust-lang.org/std/ops/trait.Drop.html) est l'équivalent de Rust." + +#: src/ownership.md:3 +#, fuzzy +msgid "" +"All variable bindings have a _scope_ where they are valid and it is an error " +"to use a variable outside its scope:" +msgstr "" +"Toutes les liaisons de variables ont un _scope_ où elles sont valides et " +"c'est une erreur de utiliser une variable en dehors de sa portée :" + +#: src/ownership.md:6 +msgid "" +"```rust,editable,compile_fail\n" +"struct Point(i32, i32);\n" +"\n" +"fn main() {\n" +" {\n" +" let p = Point(3, 4);\n" +" println!(\"x: {}\", p.0);\n" +" }\n" +" println!(\"y: {}\", p.1);\n" +"}\n" +"```" +msgstr "" + +#: src/ownership.md:18 +#, fuzzy +msgid "" +"At the end of the scope, the variable is _dropped_ and the data is freed." +msgstr "" +"A la fin du scope, la variable est _dropped_ et les données sont libérées." + +#: src/ownership.md:19 +#, fuzzy +msgid "A destructor can run here to free up resources." +msgstr "Un destructeur peut s'exécuter ici pour libérer des ressources." + +#: src/ownership.md:20 +#, fuzzy +msgid "We say that the variable _owns_ the value." +msgstr "On dit que la variable _possède_ la valeur." + +#: src/ownership/move-semantics.md:3 +#, fuzzy +msgid "An assignment will transfer _ownership_ between variables:" +msgstr "Une affectation transférera la propriété entre les variables :" + +#: src/ownership/move-semantics.md:5 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let s1: String = String::from(\"Hello!\");\n" +" let s2: String = s1;\n" +" println!(\"s2: {s2}\");\n" +" // println!(\"s1: {s1}\");\n" +"}\n" +"```" +msgstr "" + +#: src/ownership/move-semantics.md:14 +#, fuzzy +msgid "The assignment of `s1` to `s2` transfers ownership." +msgstr "L'affectation de `s1` à `s2` transfère la propriété." + +#: src/ownership/move-semantics.md:15 +#, fuzzy +msgid "When `s1` goes out of scope, nothing happens: it does not own anything." +msgstr "" +"Lorsque `s1` sort de la portée, rien ne se passe : il n'a pas de propriété." + +#: src/ownership/move-semantics.md:16 +#, fuzzy +msgid "When `s2` goes out of scope, the string data is freed." +msgstr "" +"Lorsque `s2` sort de la portée, les données de la chaîne sont libérées." + +#: src/ownership/move-semantics.md:17 +#, fuzzy +msgid "There is always _exactly_ one variable binding which owns a value." +msgstr "" +"Il y a toujours _exactement_ une liaison de variable qui possède une valeur." + +#: src/ownership/move-semantics.md:21 +#, fuzzy +msgid "" +"Mention that this is the opposite of the defaults in C++, which copies by " +"value unless you use `std::move` (and the move constructor is defined!)." +msgstr "" +"Mentionnez que c'est l'opposé des valeurs par défaut en C++, qui copie par " +"valeur à moins que vous n'utilisiez `std::move` (et que le constructeur de " +"déplacement soit défini !)." + +#: src/ownership/move-semantics.md:23 +msgid "" +"It is only the ownership that moves. Whether any machine code is generated " +"to manipulate the data itself is a matter of optimization, and such copies " +"are aggressively optimized away." +msgstr "" + +#: src/ownership/move-semantics.md:25 +msgid "" +"Simple values (such as integers) can be marked `Copy` (see later slides)." +msgstr "" + +#: src/ownership/move-semantics.md:27 +#, fuzzy +msgid "In Rust, clones are explicit (by using `clone`)." +msgstr "Dans Rust, les clones sont explicites (en utilisant `clone`)." + +#: src/ownership/moved-strings-rust.md:3 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let s1: String = String::from(\"Rust\");\n" +" let s2: String = s1;\n" +"}\n" +"```" +msgstr "" + +#: src/ownership/moved-strings-rust.md:10 +#, fuzzy +msgid "The heap data from `s1` is reused for `s2`." +msgstr "Les données de tas de `s1` sont réutilisées pour `s2`." + +#: src/ownership/moved-strings-rust.md:11 +#, fuzzy +msgid "When `s1` goes out of scope, nothing happens (it has been moved from)." +msgstr "" +"Lorsque `s1` sort de la portée, rien ne se passe (il a été déplacé de)." + +#: src/ownership/moved-strings-rust.md:13 +#, fuzzy +msgid "Before move to `s2`:" +msgstr "Avant de passer à `s2` :" + +#: src/ownership/moved-strings-rust.md:15 +msgid "" +"```bob\n" +" Stack Heap\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - -.\n" +": : : :\n" +": s1 : : :\n" +": +-----------+-------+ : : +----+----+----+----+ :\n" +": | ptr | o---+---+-----+-->| R | u | s | t | :\n" +": | len | 4 | : : +----+----+----+----+ :\n" +": | capacity | 4 | : : :\n" +": +-----------+-------+ : : :\n" +": : `- - - - - - - - - - - - - -'\n" +": :\n" +"`- - - - - - - - - - - - - -'\n" +"```" +msgstr "" + +#: src/ownership/moved-strings-rust.md:30 +#, fuzzy +msgid "After move to `s2`:" +msgstr "Après le passage à `s2` :" + +#: src/ownership/moved-strings-rust.md:32 +msgid "" +"```bob\n" +" Stack Heap\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - -.\n" +": : : :\n" +": s1 \"(inaccessible)\" : : :\n" +": +-----------+-------+ : : +----+----+----+----+ :\n" +": | ptr | o---+---+--+--+-->| R | u | s | t | :\n" +": | len | 4 | : | : +----+----+----+----+ :\n" +": | capacity | 4 | : | : :\n" +": +-----------+-------+ : | : :\n" +": : | `- - - - - - - - - - - - - -'\n" +": s2 : |\n" +": +-----------+-------+ : |\n" +": | ptr | o---+---+--'\n" +": | len | 4 | :\n" +": | capacity | 4 | :\n" +": +-----------+-------+ :\n" +": :\n" +"`- - - - - - - - - - - - - -'\n" +"```" +msgstr "" + +#: src/ownership/double-free-modern-cpp.md:1 +#, fuzzy +msgid "Extra Work in Modern C++" +msgstr "Double libération de mémoire en C++ moderne" + +#: src/ownership/double-free-modern-cpp.md:3 +#, fuzzy +msgid "Modern C++ solves this differently:" +msgstr "Le C++ moderne résout cela différemment :" + +#: src/ownership/double-free-modern-cpp.md:5 +msgid "" +"```c++\n" +"std::string s1 = \"Cpp\";\n" +"std::string s2 = s1; // Duplicate the data in s1.\n" +"```" +msgstr "" + +#: src/ownership/double-free-modern-cpp.md:10 +#, fuzzy +msgid "" +"The heap data from `s1` is duplicated and `s2` gets its own independent copy." +msgstr "" +"Les données de tas de `s1` sont dupliquées et `s2` obtient sa propre copie " +"indépendante." + +#: src/ownership/double-free-modern-cpp.md:11 +#, fuzzy +msgid "When `s1` and `s2` go out of scope, they each free their own memory." +msgstr "" +"Lorsque `s1` et `s2` sortent de la portée, ils libèrent chacun leur propre " +"mémoire." + +#: src/ownership/double-free-modern-cpp.md:13 +#, fuzzy +msgid "Before copy-assignment:" +msgstr "Avant l'affectation de copie :" + +#: src/ownership/double-free-modern-cpp.md:16 +msgid "" +"```bob\n" +" Stack Heap\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - -.\n" +": : : :\n" +": s1 : : :\n" +": +-----------+-------+ : : +----+----+----+ :\n" +": | ptr | o---+---+--+--+-->| C | p | p | :\n" +": | len | 3 | : : +----+----+----+ :\n" +": | capacity | 3 | : : :\n" +": +-----------+-------+ : : :\n" +": : `- - - - - - - - - - - -'\n" +"`- - - - - - - - - - - - - -'\n" +"```" +msgstr "" + +#: src/ownership/double-free-modern-cpp.md:30 +#, fuzzy +msgid "After copy-assignment:" +msgstr "Après l'affectation de copie :" + +#: src/ownership/double-free-modern-cpp.md:32 +msgid "" +"```bob\n" +" Stack Heap\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - -.\n" +": : : :\n" +": s1 : : :\n" +": +-----------+-------+ : : +----+----+----+ :\n" +": | ptr | o---+---+--+--+-->| C | p | p | :\n" +": | len | 3 | : : +----+----+----+ :\n" +": | capacity | 3 | : : :\n" +": +-----------+-------+ : : :\n" +": : : :\n" +": s2 : : :\n" +": +-----------+-------+ : : +----+----+----+ :\n" +": | ptr | o---+---+-----+-->| C | p | p | :\n" +": | len | 3 | : : +----+----+----+ :\n" +": | capacity | 3 | : : :\n" +": +-----------+-------+ : : :\n" +": : `- - - - - - - - - - - -'\n" +"`- - - - - - - - - - - - - -'\n" +"```" +msgstr "" + +#: src/ownership/moves-function-calls.md:3 +#, fuzzy +msgid "" +"When you pass a value to a function, the value is assigned to the function " +"parameter. This transfers ownership:" +msgstr "" +"Lorsque vous transmettez une valeur à une fonction, la valeur est affectée à " +"la fonction paramètre. Cela transfère la propriété :" + +#: src/ownership/moves-function-calls.md:6 +msgid "" +"```rust,editable\n" +"fn say_hello(name: String) {\n" +" println!(\"Hello {name}\")\n" +"}\n" +"\n" +"fn main() {\n" +" let name = String::from(\"Alice\");\n" +" say_hello(name);\n" +" // say_hello(name);\n" +"}\n" +"```" +msgstr "" + +#: src/ownership/moves-function-calls.md:20 +#, fuzzy +msgid "" +"With the first call to `say_hello`, `main` gives up ownership of `name`. " +"Afterwards, `name` cannot be used anymore within `main`." +msgstr "" +"Avec le premier appel à `say_hello`, `main` abandonne la propriété de " +"`name`. Ensuite, `name` ne peut plus être utilisé dans `main`." + +#: src/ownership/moves-function-calls.md:21 +#, fuzzy +msgid "" +"The heap memory allocated for `name` will be freed at the end of the " +"`say_hello` function." +msgstr "" +"La mémoire de tas allouée pour `name` sera libérée à la fin de la fonction " +"`say_hello`." + +#: src/ownership/moves-function-calls.md:22 +#, fuzzy +msgid "" +"`main` can retain ownership if it passes `name` as a reference (`&name`) and " +"if `say_hello` accepts a reference as a parameter." +msgstr "" +"`main` peut conserver la propriété s'il passe `name` comme référence " +"(`&name`) et si `say_hello` accepte une référence comme paramètre." + +#: src/ownership/moves-function-calls.md:23 +#, fuzzy +msgid "" +"Alternatively, `main` can pass a clone of `name` in the first call (`name." +"clone()`)." +msgstr "" +"Alternativement, `main` peut passer un clone de `name` dans le premier appel " +"(`name.clone()`)." + +#: src/ownership/moves-function-calls.md:24 +#, fuzzy +msgid "" +"Rust makes it harder than C++ to inadvertently create copies by making move " +"semantics the default, and by forcing programmers to make clones explicit." +msgstr "" +"Rust rend plus difficile que C++ la création de copies par inadvertance en " +"faisant de la sémantique de déplacement la valeur par défaut et en forçant " +"les programmeurs à rendre les clones explicites." + +#: src/ownership/copy-clone.md:3 +#, fuzzy +msgid "" +"While move semantics are the default, certain types are copied by default:" +msgstr "" +"Bien que la sémantique de déplacement soit la valeur par défaut, certains " +"types sont copiés par défaut :" + +#: src/ownership/copy-clone.md:5 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let x = 42;\n" +" let y = x;\n" +" println!(\"x: {x}\");\n" +" println!(\"y: {y}\");\n" +"}\n" +"```" +msgstr "" + +#: src/ownership/copy-clone.md:14 +#, fuzzy +msgid "These types implement the `Copy` trait." +msgstr "Ces types implémentent le trait \"Copier\"." + +#: src/ownership/copy-clone.md:16 +#, fuzzy +msgid "You can opt-in your own types to use copy semantics:" +msgstr "" +"Vous pouvez activer vos propres types pour utiliser la sémantique de copie :" + +#: src/ownership/copy-clone.md:18 +msgid "" +"```rust,editable\n" +"#[derive(Copy, Clone, Debug)]\n" +"struct Point(i32, i32);\n" +"\n" +"fn main() {\n" +" let p1 = Point(3, 4);\n" +" let p2 = p1;\n" +" println!(\"p1: {p1:?}\");\n" +" println!(\"p2: {p2:?}\");\n" +"}\n" +"```" +msgstr "" + +#: src/ownership/copy-clone.md:30 +#, fuzzy +msgid "After the assignment, both `p1` and `p2` own their own data." +msgstr "Après l'affectation, `p1` et `p2` possèdent leurs propres données." + +#: src/ownership/copy-clone.md:31 +#, fuzzy +msgid "We can also use `p1.clone()` to explicitly copy the data." +msgstr "" +"Nous pouvons également utiliser `p1.clone()` pour copier explicitement les " +"données." + +#: src/ownership/copy-clone.md:35 +#, fuzzy +msgid "Copying and cloning are not the same thing:" +msgstr "La copie et le clonage ne sont pas la même chose :" + +#: src/ownership/copy-clone.md:37 +#, fuzzy +msgid "" +"Copying refers to bitwise copies of memory regions and does not work on " +"arbitrary objects." +msgstr "" +"La copie fait référence aux copies au niveau du bit des régions de mémoire " +"et ne fonctionne pas sur des objets arbitraires." + +#: src/ownership/copy-clone.md:38 +#, fuzzy +msgid "" +"Copying does not allow for custom logic (unlike copy constructors in C++)." +msgstr "" +"La copie ne permet pas de logique personnalisée (contrairement aux " +"constructeurs de copie en C++)." + +#: src/ownership/copy-clone.md:39 +#, fuzzy +msgid "" +"Cloning is a more general operation and also allows for custom behavior by " +"implementing the `Clone` trait." +msgstr "" +"Le clonage est une opération plus générale et permet également un " +"comportement personnalisé en implémentant le trait \"Cloner\"." + +#: src/ownership/copy-clone.md:40 +#, fuzzy +msgid "Copying does not work on types that implement the `Drop` trait." +msgstr "" +"La copie ne fonctionne pas sur les types qui implémentent le trait `Drop`." + +#: src/ownership/copy-clone.md:42 src/ownership/lifetimes-function-calls.md:29 +#, fuzzy +msgid "In the above example, try the following:" +msgstr "Dans l'exemple ci-dessus, essayez ce qui suit :" + +#: src/ownership/copy-clone.md:44 +#, fuzzy +msgid "" +"Add a `String` field to `struct Point`. It will not compile because `String` " +"is not a `Copy` type." +msgstr "" +"Ajoutez un champ `String` à `struct Point`. Il ne sera pas compilé car " +"`String` n'est pas un type `Copy`." + +#: src/ownership/copy-clone.md:45 +#, fuzzy +msgid "" +"Remove `Copy` from the `derive` attribute. The compiler error is now in the " +"`println!` for `p1`." +msgstr "" +"Supprimer `Copy` de l'attribut `derive`. L'erreur du compilateur est " +"maintenant dans `println!` pour `p1`." + +#: src/ownership/copy-clone.md:46 +#, fuzzy +msgid "Show that it works if you clone `p1` instead." +msgstr "Montrez que cela fonctionne si vous clonez `p1` à la place." + +#: src/ownership/copy-clone.md:48 +#, fuzzy +msgid "" +"If students ask about `derive`, it is sufficient to say that this is a way " +"to generate code in Rust at compile time. In this case the default " +"implementations of `Copy` and `Clone` traits are generated." +msgstr "" +"Si les étudiants posent des questions sur \"dériver\", il suffit de dire que " +"c'est un moyen de générer du code dans Rust au moment de la compilation. " +"Dans ce cas, les implémentations par défaut des traits `Copy` et `Clone` " +"sont générées." + +#: src/ownership/borrowing.md:3 +#, fuzzy +msgid "" +"Instead of transferring ownership when calling a function, you can let a " +"function _borrow_ the value:" +msgstr "" +"Au lieu de transférer la propriété lors de l'appel d'une fonction, vous " +"pouvez laisser une la fonction _emprunte_ la valeur :" + +#: src/ownership/borrowing.md:6 +msgid "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Point(i32, i32);\n" +"\n" +"fn add(p1: &Point, p2: &Point) -> Point {\n" +" Point(p1.0 + p2.0, p1.1 + p2.1)\n" +"}\n" +"\n" +"fn main() {\n" +" let p1 = Point(3, 4);\n" +" let p2 = Point(10, 20);\n" +" let p3 = add(&p1, &p2);\n" +" println!(\"{p1:?} + {p2:?} = {p3:?}\");\n" +"}\n" +"```" +msgstr "" + +#: src/ownership/borrowing.md:22 +#, fuzzy +msgid "The `add` function _borrows_ two points and returns a new point." +msgstr "La fonction `add` _emprunte_ deux points et renvoie un nouveau point." + +#: src/ownership/borrowing.md:23 +#, fuzzy +msgid "The caller retains ownership of the inputs." +msgstr "L'appelant conserve la propriété des entrées." + +#: src/ownership/borrowing.md:27 +#, fuzzy +msgid "Notes on stack returns:" +msgstr "Remarques sur les retours de pile :" + +#: src/ownership/borrowing.md:28 +msgid "" +"Demonstrate that the return from `add` is cheap because the compiler can " +"eliminate the copy operation. Change the above code to print stack addresses " +"and run it on the [Playground](https://play.rust-lang.org/) or look at the " +"assembly in [Godbolt](https://rust.godbolt.org/). In the \"DEBUG\" " +"optimization level, the addresses should change, while they stay the same " +"when changing to the \"RELEASE\" setting:" +msgstr "" + +#: src/ownership/borrowing.md:30 +msgid "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Point(i32, i32);\n" +"\n" +"fn add(p1: &Point, p2: &Point) -> Point {\n" +" let p = Point(p1.0 + p2.0, p1.1 + p2.1);\n" +" println!(\"&p.0: {:p}\", &p.0);\n" +" p\n" +"}\n" +"\n" +"pub fn main() {\n" +" let p1 = Point(3, 4);\n" +" let p2 = Point(10, 20);\n" +" let p3 = add(&p1, &p2);\n" +" println!(\"&p3.0: {:p}\", &p3.0);\n" +" println!(\"{p1:?} + {p2:?} = {p3:?}\");\n" +"}\n" +"```" +msgstr "" + +#: src/ownership/borrowing.md:48 +msgid "The Rust compiler can do return value optimization (RVO)." +msgstr "" + +#: src/ownership/borrowing.md:49 +msgid "" +"In C++, copy elision has to be defined in the language specification because " +"constructors can have side effects. In Rust, this is not an issue at all. If " +"RVO did not happen, Rust will always perform a simple and efficient `memcpy` " +"copy." +msgstr "" + +#: src/ownership/shared-unique-borrows.md:3 +#, fuzzy +msgid "Rust puts constraints on the ways you can borrow values:" +msgstr "" +"Rust impose des contraintes sur la manière dont vous pouvez emprunter des " +"valeurs :" + +#: src/ownership/shared-unique-borrows.md:5 +#, fuzzy +msgid "You can have one or more `&T` values at any given time, _or_" +msgstr "Vous pouvez avoir une ou plusieurs valeurs `&T` à tout moment, _ou_" + +#: src/ownership/shared-unique-borrows.md:6 +#, fuzzy +msgid "You can have exactly one `&mut T` value." +msgstr "Vous pouvez avoir exactement une valeur `&mut T`." + +#: src/ownership/shared-unique-borrows.md:8 +msgid "" +"```rust,editable,compile_fail\n" +"fn main() {\n" +" let mut a: i32 = 10;\n" +" let b: &i32 = &a;\n" +"\n" +" {\n" +" let c: &mut i32 = &mut a;\n" +" *c = 20;\n" +" }\n" +"\n" +" println!(\"a: {a}\");\n" +" println!(\"b: {b}\");\n" +"}\n" +"```" +msgstr "" + +#: src/ownership/shared-unique-borrows.md:25 +#, fuzzy +msgid "" +"The above code does not compile because `a` is borrowed as mutable (through " +"`c`) and as immutable (through `b`) at the same time." +msgstr "" +"Le code ci-dessus ne se compile pas car 'a' est emprunté comme mutable (via " +"'c') et comme immuable (via 'b') en même temps." + +#: src/ownership/shared-unique-borrows.md:26 +#, fuzzy +msgid "" +"Move the `println!` statement for `b` before the scope that introduces `c` " +"to make the code compile." +msgstr "" +"Déplacez l'instruction `println!` pour `b` avant la portée qui introduit `c` " +"pour que le code soit compilé." + +#: src/ownership/shared-unique-borrows.md:27 +#, fuzzy +msgid "" +"After that change, the compiler realizes that `b` is only ever used before " +"the new mutable borrow of `a` through `c`. This is a feature of the borrow " +"checker called \"non-lexical lifetimes\"." +msgstr "" +"Après ce changement, le compilateur se rend compte que 'b' n'est utilisé " +"qu'avant le nouvel emprunt mutable de 'a' à 'c'. Il s'agit d'une " +"fonctionnalité du vérificateur d'emprunt appelée \"durées de vie non " +"lexicales\"." + +#: src/ownership/lifetimes.md:3 +#, fuzzy +msgid "A borrowed value has a _lifetime_:" +msgstr "Une valeur empruntée a une _durée de vie_ :" + +#: src/ownership/lifetimes.md:5 +msgid "The lifetime can be implicit: `add(p1: &Point, p2: &Point) -> Point`." +msgstr "" + +#: src/ownership/lifetimes.md:6 +msgid "Lifetimes can also be explicit: `&'a Point`, `&'document str`." +msgstr "" + +#: src/ownership/lifetimes.md:7 src/ownership/lifetimes-function-calls.md:23 +#, fuzzy +msgid "" +"Read `&'a Point` as \"a borrowed `Point` which is valid for at least the " +"lifetime `a`\"." +msgstr "" +"Lire `&'a Point` comme \"un `Point` emprunté qui est valide pour au moins " +"durée de vie 'a'\"." + +#: src/ownership/lifetimes.md:9 +msgid "" +"Lifetimes are always inferred by the compiler: you cannot assign a lifetime " +"yourself." +msgstr "" + +#: src/ownership/lifetimes.md:11 +msgid "" +"Lifetime annotations create constraints; the compiler verifies that there is " +"a valid solution." +msgstr "" + +#: src/ownership/lifetimes.md:13 +msgid "" +"Lifetimes for function arguments and return values must be fully specified, " +"but Rust allows lifetimes to be elided in most cases with [a few simple " +"rules](https://doc.rust-lang.org/nomicon/lifetime-elision.html)." +msgstr "" + +#: src/ownership/lifetimes-function-calls.md:3 +#, fuzzy +msgid "" +"In addition to borrowing its arguments, a function can return a borrowed " +"value:" +msgstr "" +"En plus d'emprunter ses arguments, une fonction peut renvoyer une valeur " +"empruntée :" + +#: src/ownership/lifetimes-function-calls.md:5 +msgid "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Point(i32, i32);\n" +"\n" +"fn left_most<'a>(p1: &'a Point, p2: &'a Point) -> &'a Point {\n" +" if p1.0 < p2.0 { p1 } else { p2 }\n" +"}\n" +"\n" +"fn main() {\n" +" let p1: Point = Point(10, 10);\n" +" let p2: Point = Point(20, 20);\n" +" let p3: &Point = left_most(&p1, &p2);\n" +" println!(\"left-most point: {:?}\", p3);\n" +"}\n" +"```" +msgstr "" + +#: src/ownership/lifetimes-function-calls.md:21 +#, fuzzy +msgid "`'a` is a generic parameter, it is inferred by the compiler." +msgstr "`'a` est un paramètre générique, il est déduit par le compilateur." + +#: src/ownership/lifetimes-function-calls.md:22 +#, fuzzy +msgid "Lifetimes start with `'` and `'a` is a typical default name." +msgstr "" +"Les durées de vie commencent par `'` et `'a` est un nom par défaut typique." + +#: src/ownership/lifetimes-function-calls.md:25 +#, fuzzy +msgid "" +"The _at least_ part is important when parameters are in different scopes." +msgstr "" +"La partie _au moins_ est importante lorsque les paramètres sont dans des " +"portées différentes." + +#: src/ownership/lifetimes-function-calls.md:31 +msgid "" +"Move the declaration of `p2` and `p3` into a new scope (`{ ... }`), " +"resulting in the following code:" +msgstr "" + +#: src/ownership/lifetimes-function-calls.md:32 +msgid "" +"```rust,ignore\n" +"#[derive(Debug)]\n" +"struct Point(i32, i32);\n" +"\n" +"fn left_most<'a>(p1: &'a Point, p2: &'a Point) -> &'a Point {\n" +" if p1.0 < p2.0 { p1 } else { p2 }\n" +"}\n" +"\n" +"fn main() {\n" +" let p1: Point = Point(10, 10);\n" +" let p3: &Point;\n" +" {\n" +" let p2: Point = Point(20, 20);\n" +" p3 = left_most(&p1, &p2);\n" +" }\n" +" println!(\"left-most point: {:?}\", p3);\n" +"}\n" +"```" +msgstr "" + +#: src/ownership/lifetimes-function-calls.md:50 +msgid "Note how this does not compile since `p3` outlives `p2`." +msgstr "" + +#: src/ownership/lifetimes-function-calls.md:52 +msgid "" +"Reset the workspace and change the function signature to `fn left_most<'a, " +"'b>(p1: &'a Point, p2: &'a Point) -> &'b Point`. This will not compile " +"because the relationship between the lifetimes `'a` and `'b` is unclear." +msgstr "" + +#: src/ownership/lifetimes-function-calls.md:53 +msgid "Another way to explain it:" +msgstr "" + +#: src/ownership/lifetimes-function-calls.md:54 +msgid "" +"Two references to two values are borrowed by a function and the function " +"returns another reference." +msgstr "" + +#: src/ownership/lifetimes-function-calls.md:56 +msgid "" +"It must have come from one of those two inputs (or from a global variable)." +msgstr "" + +#: src/ownership/lifetimes-function-calls.md:57 +msgid "" +"Which one is it? The compiler needs to know, so at the call site the " +"returned reference is not used for longer than a variable from where the " +"reference came from." +msgstr "" + +#: src/ownership/lifetimes-data-structures.md:3 +#, fuzzy +msgid "" +"If a data type stores borrowed data, it must be annotated with a lifetime:" +msgstr "" +"Si un type de données stocke des données empruntées, il doit être annoté " +"avec une durée de vie :" + +#: src/ownership/lifetimes-data-structures.md:5 +msgid "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Highlight<'doc>(&'doc str);\n" +"\n" +"fn erase(text: String) {\n" +" println!(\"Bye {text}!\");\n" +"}\n" +"\n" +"fn main() {\n" +" let text = String::from(\"The quick brown fox jumps over the lazy dog." +"\");\n" +" let fox = Highlight(&text[4..19]);\n" +" let dog = Highlight(&text[35..43]);\n" +" // erase(text);\n" +" println!(\"{fox:?}\");\n" +" println!(\"{dog:?}\");\n" +"}\n" +"```" +msgstr "" + +#: src/ownership/lifetimes-data-structures.md:25 +#, fuzzy +msgid "" +"In the above example, the annotation on `Highlight` enforces that the data " +"underlying the contained `&str` lives at least as long as any instance of " +"`Highlight` that uses that data." +msgstr "" +"Dans l'exemple ci-dessus, l'annotation sur `Highlight` impose que les " +"données sous-jacentes au `&str` contenu vivent au moins aussi longtemps que " +"toute instance de `Highlight` qui utilise ces données." + +#: src/ownership/lifetimes-data-structures.md:26 +#, fuzzy +msgid "" +"If `text` is consumed before the end of the lifetime of `fox` (or `dog`), " +"the borrow checker throws an error." +msgstr "" +"Si `text` est consommé avant la fin de la durée de vie de `fox` (ou `dog`), " +"le vérificateur d'emprunt génère une erreur." + +#: src/ownership/lifetimes-data-structures.md:27 +#, fuzzy +msgid "" +"Types with borrowed data force users to hold on to the original data. This " +"can be useful for creating lightweight views, but it generally makes them " +"somewhat harder to use." +msgstr "" +"Les types avec des données empruntées obligent les utilisateurs à conserver " +"les données d'origine. Cela peut être utile pour créer des vues légères, " +"mais cela les rend généralement un peu plus difficiles à utiliser." + +#: src/ownership/lifetimes-data-structures.md:28 +#, fuzzy +msgid "When possible, make data structures own their data directly." +msgstr "" +"Dans la mesure du possible, faites en sorte que les structures de données " +"soient directement propriétaires de leurs données." + +#: src/ownership/lifetimes-data-structures.md:29 +#, fuzzy +msgid "" +"Some structs with multiple references inside can have more than one lifetime " +"annotation. This can be necessary if there is a need to describe lifetime " +"relationships between the references themselves, in addition to the lifetime " +"of the struct itself. Those are very advanced use cases." +msgstr "" +"Certaines structures contenant plusieurs références peuvent avoir plusieurs " +"annotations de durée de vie. Cela peut être nécessaire s'il est nécessaire " +"de décrire les relations de durée de vie entre les références elles-mêmes, " +"en plus de la durée de vie de la structure elle-même. Ce sont des cas " +"d'utilisation très avancés." + +#: src/structs.md:3 +#, fuzzy +msgid "Like C and C++, Rust has support for custom structs:" +msgstr "Comme C et C++, Rust prend en charge les structures personnalisées :" + +#: src/structs.md:5 +msgid "" +"```rust,editable\n" +"struct Person {\n" +" name: String,\n" +" age: u8,\n" +"}\n" +"\n" +"fn main() {\n" +" let mut peter = Person {\n" +" name: String::from(\"Peter\"),\n" +" age: 27,\n" +" };\n" +" println!(\"{} is {} years old\", peter.name, peter.age);\n" +" \n" +" peter.age = 28;\n" +" println!(\"{} is {} years old\", peter.name, peter.age);\n" +" \n" +" let jackie = Person {\n" +" name: String::from(\"Jackie\"),\n" +" ..peter\n" +" };\n" +" println!(\"{} is {} years old\", jackie.name, jackie.age);\n" +"}\n" +"```" +msgstr "" + +#: src/structs.md:33 +msgid "Structs work like in C or C++." +msgstr "" + +#: src/structs.md:34 +msgid "Like in C++, and unlike in C, no typedef is needed to define a type." +msgstr "" + +#: src/structs.md:35 +msgid "Unlike in C++, there is no inheritance between structs." +msgstr "" + +#: src/structs.md:36 +msgid "" +"Methods are defined in an `impl` block, which we will see in following " +"slides." +msgstr "" + +#: src/structs.md:37 +msgid "" +"This may be a good time to let people know there are different types of " +"structs. " +msgstr "" + +#: src/structs.md:38 +msgid "" +"Zero-sized structs `e.g., struct Foo;` might be used when implementing a " +"trait on some type but don’t have any data that you want to store in the " +"value itself. " +msgstr "" + +#: src/structs.md:39 +msgid "" +"The next slide will introduce Tuple structs, used when the field names are " +"not important." +msgstr "" + +#: src/structs.md:40 +msgid "" +"The syntax `..peter` allows us to copy the majority of the fields from the " +"old struct without having to explicitly type it all out. It must always be " +"the last element." +msgstr "" + +#: src/structs/tuple-structs.md:3 +#, fuzzy +msgid "If the field names are unimportant, you can use a tuple struct:" +msgstr "" +"Si les noms de champ ne sont pas importants, vous pouvez utiliser une " +"structure tuple :" + +#: src/structs/tuple-structs.md:5 +msgid "" +"```rust,editable\n" +"struct Point(i32, i32);\n" +"\n" +"fn main() {\n" +" let p = Point(17, 23);\n" +" println!(\"({}, {})\", p.0, p.1);\n" +"}\n" +"```" +msgstr "" + +#: src/structs/tuple-structs.md:14 +#, fuzzy +msgid "This is often used for single-field wrappers (called newtypes):" +msgstr "" +"Ceci est souvent utilisé pour les wrappers à champ unique (appelés newtypes):" + +#: src/structs/tuple-structs.md:16 +msgid "" +"```rust,editable,compile_fail\n" +"struct PoundsOfForce(f64);\n" +"struct Newtons(f64);\n" +"\n" +"fn compute_thruster_force() -> PoundsOfForce {\n" +" todo!(\"Ask a rocket scientist at NASA\")\n" +"}\n" +"\n" +"fn set_thruster_force(force: Newtons) {\n" +" // ...\n" +"}\n" +"\n" +"fn main() {\n" +" let force = compute_thruster_force();\n" +" set_thruster_force(force);\n" +"}\n" +"\n" +"```" +msgstr "" + +#: src/structs/tuple-structs.md:37 +#, fuzzy +msgid "" +"Newtypes are a great way to encode additional information about the value in " +"a primitive type, for example:" +msgstr "" +"Les nouveaux types sont un excellent moyen d'encoder des informations " +"supplémentaires sur la valeur dans un type primitif, par exemple :" + +#: src/structs/tuple-structs.md:38 +#, fuzzy +msgid "The number is measured in some units: `Newtons` in the example above." +msgstr "" +"Le nombre est mesuré dans certaines unités : `Newtons` dans l'exemple ci-" +"dessus." + +#: src/structs/tuple-structs.md:39 +#, fuzzy +msgid "" +"The value passed some validation when it was created, so you no longer have " +"to validate it again at every use: 'PhoneNumber(String)`or`OddNumber(u32)\\`." +msgstr "" +"La valeur a été validée lors de sa création, vous n'avez donc plus besoin de " +"la valider à chaque utilisation : 'PhoneNumber(String)`ou`OddNumber(u32)\\`." + +#: src/structs/tuple-structs.md:40 +#, fuzzy +msgid "" +"Demonstrate how to add a `f64` value to a `Newtons` type by accessing the " +"single field in the newtype." +msgstr "" +"Montrez comment ajouter une valeur `f64` à un type `Newtons` en accédant au " +"champ unique dans le nouveau type." + +#: src/structs/tuple-structs.md:41 +#, fuzzy +msgid "" +"Rust generally doesn’t like inexplicit things, like automatic unwrapping or " +"for instance using booleans as integers." +msgstr "" +"Rust n'aime généralement pas les choses inexplicites, comme le déballage " +"automatique ou, par exemple, l'utilisation de booléens comme entiers." + +#: src/structs/tuple-structs.md:42 +#, fuzzy +msgid "Operator overloading is discussed on Day 3 (generics)." +msgstr "La surcharge des opérateurs est discutée le jour 3 (génériques)." + +#: src/structs/tuple-structs.md:43 +msgid "" +"The example is a subtle reference to the [Mars Climate Orbiter](https://en." +"wikipedia.org/wiki/Mars_Climate_Orbiter) failure." +msgstr "" + +#: src/structs/field-shorthand.md:3 +#, fuzzy +msgid "" +"If you already have variables with the right names, then you can create the " +"struct using a shorthand:" +msgstr "" +"Si vous avez déjà des variables avec les bons noms, vous pouvez créer le " +"struct en utilisant un raccourci :" + +#: src/structs/field-shorthand.md:6 +msgid "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Person {\n" +" name: String,\n" +" age: u8,\n" +"}\n" +"\n" +"impl Person {\n" +" fn new(name: String, age: u8) -> Person {\n" +" Person { name, age }\n" +" }\n" +"}\n" +"\n" +"fn main() {\n" +" let peter = Person::new(String::from(\"Peter\"), 27);\n" +" println!(\"{peter:?}\");\n" +"}\n" +"```" +msgstr "" + +#: src/structs/field-shorthand.md:27 +msgid "" +"The `new` function could be written using `Self` as a type, as it is " +"interchangeable with the struct type name" +msgstr "" + +#: src/structs/field-shorthand.md:29 +msgid "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Person {\n" +" name: String,\n" +" age: u8,\n" +"}\n" +"impl Person {\n" +" fn new(name: String, age: u8) -> Self {\n" +" Self { name, age }\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/structs/field-shorthand.md:41 +msgid "" +"Implement the `Default` trait for the struct. Define some fields and use the " +"default values for the other fields." +msgstr "" + +#: src/structs/field-shorthand.md:43 +msgid "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Person {\n" +" name: String,\n" +" age: u8,\n" +"}\n" +"impl Default for Person {\n" +" fn default() -> Person {\n" +" Person {\n" +" name: \"Bot\".to_string(),\n" +" age: 0,\n" +" }\n" +" }\n" +"}\n" +"fn create_default() {\n" +" let tmp = Person {\n" +" ..Person::default()\n" +" };\n" +" let tmp = Person {\n" +" name: \"Sam\".to_string(),\n" +" ..Person::default()\n" +" };\n" +"}\n" +"```" +msgstr "" + +#: src/structs/field-shorthand.md:68 +msgid "Methods are defined in the `impl` block." +msgstr "" + +#: src/structs/field-shorthand.md:69 +msgid "" +"Use struct update syntax to define a new structure using `peter`. Note that " +"the variable `peter` will no longer be accessible afterwards." +msgstr "" + +#: src/structs/field-shorthand.md:70 +msgid "" +"Use `{:#?}` when printing structs to request the `Debug` representation." +msgstr "" + +#: src/methods.md:3 +#, fuzzy +msgid "" +"Rust allows you to associate functions with your new types. You do this with " +"an `impl` block:" +msgstr "" +"Rust vous permet d'associer des fonctions à vos nouveaux types. Vous faites " +"cela avec un Bloc `impl` :" + +#: src/methods.md:6 +msgid "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Person {\n" +" name: String,\n" +" age: u8,\n" +"}\n" +"\n" +"impl Person {\n" +" fn say_hello(&self) {\n" +" println!(\"Hello, my name is {}\", self.name);\n" +" }\n" +"}\n" +"\n" +"fn main() {\n" +" let peter = Person {\n" +" name: String::from(\"Peter\"),\n" +" age: 27,\n" +" };\n" +" peter.say_hello();\n" +"}\n" +"```" +msgstr "" + +#: src/methods.md:31 +#, fuzzy +msgid "It can be helpful to introduce methods by comparing them to functions." +msgstr "" +"Il peut être utile d'introduire des méthodes en les comparant à des " +"fonctions." + +#: src/methods.md:32 +#, fuzzy +msgid "" +"Methods are called on an instance of a type (such as a struct or enum), the " +"first parameter represents the instance as `self`." +msgstr "" +"Les méthodes sont appelées sur une instance d'un type (tel qu'un struct ou " +"un enum), le premier paramètre représente l'instance en tant que \"self\"." + +#: src/methods.md:33 +#, fuzzy +msgid "" +"Developers may choose to use methods to take advantage of method receiver " +"syntax and to help keep them more organized. By using methods we can keep " +"all the implementation code in one predictable place." +msgstr "" +"Les développeurs peuvent choisir d'utiliser des méthodes pour tirer parti de " +"la syntaxe du récepteur de méthode et pour mieux les organiser. En utilisant " +"des méthodes, nous pouvons conserver tout le code d'implémentation en un " +"seul endroit prévisible." + +#: src/methods.md:34 +#, fuzzy +msgid "Point out the use of the keyword `self`, a method receiver." +msgstr "Soulignez l'utilisation du mot-clé `self`, un récepteur de méthode." + +#: src/methods.md:35 +#, fuzzy +msgid "" +"Show that it is an abbreviated term for `self: Self` and perhaps show how " +"the struct name could also be used." +msgstr "" +"Montrez qu'il s'agit d'un terme abrégé pour `self:&Self` et montrez peut-" +"être comment le nom de la structure pourrait également être utilisé." + +#: src/methods.md:36 +#, fuzzy +msgid "" +"Explain that `Self` is a type alias for the type the `impl` block is in and " +"can be used elsewhere in the block." +msgstr "" +"Expliquez que `Self` est un alias de type pour le type dans lequel se trouve " +"le bloc `impl` et peut être utilisé ailleurs dans le bloc." + +#: src/methods.md:37 +#, fuzzy +msgid "" +"Note how `self` is used like other structs and dot notation can be used to " +"refer to individual fields." +msgstr "" +"Notez comment `self` est utilisé comme d'autres structures et la notation " +"par points peut être utilisée pour faire référence à des champs individuels." + +#: src/methods.md:38 +#, fuzzy +msgid "" +"This might be a good time to demonstrate how the `&self` differs from `self` " +"by modifying the code and trying to run say_hello twice." +msgstr "" +"C'est peut-être le bon moment pour démontrer en quoi `&self` diffère de " +"`self` en modifiant le code et en essayant d'exécuter say_hello deux fois." + +#: src/methods.md:39 +#, fuzzy +msgid "We describe the distinction between method receivers next." +msgstr "Nous décrivons ensuite la distinction entre les récepteurs de méthode." + +#: src/methods/receiver.md:3 +#, fuzzy +msgid "" +"The `&self` above indicates that the method borrows the object immutably. " +"There are other possible receivers for a method:" +msgstr "" +"Le `&self` ci-dessus indique que la méthode emprunte l'objet de manière " +"immuable. Là sont d'autres récepteurs possibles pour une méthode :" + +#: src/methods/receiver.md:6 +#, fuzzy +msgid "" +"`&self`: borrows the object from the caller using a shared and immutable " +"reference. The object can be used again afterwards." +msgstr "" +"`&self` : emprunte l'objet à l'appelant en utilisant un partage et immuable " +"référence. L'objet peut être réutilisé par la suite." + +#: src/methods/receiver.md:8 +#, fuzzy +msgid "" +"`&mut self`: borrows the object from the caller using a unique and mutable " +"reference. The object can be used again afterwards." +msgstr "" +"`&mut self` : emprunte l'objet à l'appelant en utilisant un nom unique et " +"mutable référence. L'objet peut être réutilisé par la suite." + +#: src/methods/receiver.md:10 +#, fuzzy +msgid "" +"`self`: takes ownership of the object and moves it away from the caller. The " +"method becomes the owner of the object. The object will be dropped " +"(deallocated) when the method returns, unless its ownership is explicitly " +"transmitted. Complete ownership does not automatically mean mutability." +msgstr "" +"`self` : prend possession de l'objet et l'éloigne de l'appelant. Le méthode " +"devient le propriétaire de l'objet. L'objet sera supprimé (désalloué) " +"lorsque la méthode revient, sauf si sa propriété est explicitement transmis." + +#: src/methods/receiver.md:14 +#, fuzzy +msgid "`mut self`: same as above, but the method can mutate the object. " +msgstr "" +"`mut self` : comme ci-dessus, mais tant que la méthode possède l'objet, elle " +"peut le faire muter aussi. La propriété complète ne signifie pas " +"automatiquement la mutabilité." + +#: src/methods/receiver.md:15 +#, fuzzy +msgid "" +"No receiver: this becomes a static method on the struct. Typically used to " +"create constructors which are called `new` by convention." +msgstr "" +"Pas de récepteur : cela devient une méthode statique sur la structure. " +"Généralement utilisé pour créer des constructeurs appelés \"nouveaux\" par " +"convention." + +#: src/methods/receiver.md:18 +#, fuzzy +msgid "" +"Beyond variants on `self`, there are also [special wrapper types](https://" +"doc.rust-lang.org/reference/special-types-and-traits.html) allowed to be " +"receiver types, such as `Box`." +msgstr "" +"Au-delà des variantes sur \"self\", il y a aussi \\[types d'emballage " +"spéciaux\\] (https://doc.rust-lang.org/reference/special-types-and-traits." +"html) autorisés à être des types de récepteurs, tels que `Box`." + +#: src/methods/receiver.md:24 +#, fuzzy +msgid "" +"Consider emphasizing \"shared and immutable\" and \"unique and mutable\". " +"These constraints always come together in Rust due to borrow checker rules, " +"and `self` is no exception. It isn't possible to reference a struct from " +"multiple locations and call a mutating (`&mut self`) method on it." +msgstr "" +"Pensez à mettre l'accent sur \"partagé et immuable\" et \"unique et " +"modifiable\". Ces contraintes viennent toujours ensemble dans Rust en raison " +"des règles du vérificateur d'emprunt, et \"self\" ne fait pas exception. Il " +"n'est pas possible de référencez une structure à partir de plusieurs " +"emplacements et appelez une méthode de mutation (`&mut self`) sur celle-ci." + +#: src/methods/example.md:3 +msgid "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Race {\n" +" name: String,\n" +" laps: Vec,\n" +"}\n" +"\n" +"impl Race {\n" +" fn new(name: &str) -> Race { // No receiver, a static method\n" +" Race { name: String::from(name), laps: Vec::new() }\n" +" }\n" +"\n" +" fn add_lap(&mut self, lap: i32) { // Exclusive borrowed read-write " +"access to self\n" +" self.laps.push(lap);\n" +" }\n" +"\n" +" fn print_laps(&self) { // Shared and read-only borrowed access to self\n" +" println!(\"Recorded {} laps for {}:\", self.laps.len(), self.name);\n" +" for (idx, lap) in self.laps.iter().enumerate() {\n" +" println!(\"Lap {idx}: {lap} sec\");\n" +" }\n" +" }\n" +"\n" +" fn finish(self) { // Exclusive ownership of self\n" +" let total = self.laps.iter().sum::();\n" +" println!(\"Race {} is finished, total lap time: {}\", self.name, " +"total);\n" +" }\n" +"}\n" +"\n" +"fn main() {\n" +" let mut race = Race::new(\"Monaco Grand Prix\");\n" +" race.add_lap(70);\n" +" race.add_lap(68);\n" +" race.print_laps();\n" +" race.add_lap(71);\n" +" race.print_laps();\n" +" race.finish();\n" +" // race.add_lap(42);\n" +"}\n" +"```" +msgstr "" + +#: src/methods/example.md:47 +#, fuzzy +msgid "All four methods here use a different method receiver." +msgstr "Les quatre méthodes ici utilisent un récepteur de méthode différent." + +#: src/methods/example.md:48 +#, fuzzy +msgid "" +"You can point out how that changes what the function can do with the " +"variable values and if/how it can be used again in `main`." +msgstr "" +"Vous pouvez indiquer comment cela change ce que la fonction peut faire avec " +"les valeurs des variables et si/comment elle peut être réutilisée dans " +"`main`." + +#: src/methods/example.md:49 +#, fuzzy +msgid "" +"You can showcase the error that appears when trying to call `finish` twice." +msgstr "" +"Vous pouvez afficher l'erreur qui apparaît lorsque vous essayez d'appeler " +"\"finish\" deux fois." + +#: src/methods/example.md:50 +#, fuzzy +msgid "" +"Note that although the method receivers are different, the non-static " +"functions are called the same way in the main body. Rust enables automatic " +"referencing and dereferencing when calling methods. Rust automatically adds " +"in the `&`, `*`, `muts` so that that object matches the method signature." +msgstr "" +"Notez que bien que les récepteurs de méthode soient différents, les " +"fonctions non statiques sont appelées de la même manière dans le corps " +"principal. Rust permet le référencement et le déréférencement automatique " +"lors de l'appel de méthodes. Rust ajoute automatiquement les `&`, `*`, " +"`muts` afin que cet objet corresponde à la signature de la méthode." + +#: src/methods/example.md:51 +#, fuzzy +msgid "" +"You might point out that `print_laps` is using a vector that is iterated " +"over. We describe vectors in more detail in the afternoon. " +msgstr "" +"Vous pourriez remarquer que `print_laps` utilise un vecteur qui est itéré. " +"Nous décrivons les vecteurs plus en détail dans l'après-midi." + #: src/exercises/day-2/morning.md:1 #, fuzzy msgid "Day 2: Morning Exercises" @@ -7519,14 +7927,138 @@ msgstr "" "Nous nous intéresserons à la mise en œuvre des méthodes dans deux contextes :" #: src/exercises/day-2/morning.md:5 -#, fuzzy -msgid "Simple struct which tracks health statistics." -msgstr "Structure simple qui suit les statistiques de santé." +msgid "Storing books and querying the collection" +msgstr "" #: src/exercises/day-2/morning.md:7 +msgid "Keeping track of health statistics for patients" +msgstr "" + +#: src/exercises/day-2/book-library.md:3 #, fuzzy -msgid "Multiple structs and enums for a drawing library." -msgstr "Plusieurs structures et énumérations pour une bibliothèque de dessins." +msgid "" +"We will learn much more about structs and the `Vec` type tomorrow. For " +"now, you just need to know part of its API:" +msgstr "" +"Nous en apprendrons beaucoup plus sur les structures et le type `Vec` " +"demain. Pour l'instant, vous avez juste besoin de connaître une partie de " +"son API :" + +#: src/exercises/day-2/book-library.md:6 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let mut vec = vec![10, 20];\n" +" vec.push(30);\n" +" let midpoint = vec.len() / 2;\n" +" println!(\"middle value: {}\", vec[midpoint]);\n" +" for item in &vec {\n" +" println!(\"item: {item}\");\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/day-2/book-library.md:18 +#, fuzzy +msgid "" +"Use this to model a library's book collection. Copy the code below to " +" and update the types to make it compile:" +msgstr "" +"Utilisez-le pour créer une application de bibliothèque. Copiez le code ci-" +"dessous pour et mettez à jour les types pour " +"le faire compiler :" + +#: src/exercises/day-2/book-library.md:21 +msgid "" +"```rust,should_panic\n" +"struct Library {\n" +" books: Vec,\n" +"}\n" +"\n" +"struct Book {\n" +" title: String,\n" +" year: u16,\n" +"}\n" +"\n" +"impl Book {\n" +" // This is a constructor, used below.\n" +" fn new(title: &str, year: u16) -> Book {\n" +" Book {\n" +" title: String::from(title),\n" +" year,\n" +" }\n" +" }\n" +"}\n" +"\n" +"// Implement the methods below. Update the `self` parameter to\n" +"// indicate the method's required level of ownership over the object:\n" +"//\n" +"// - `&self` for shared read-only access,\n" +"// - `&mut self` for unique and mutable access,\n" +"// - `self` for unique access by value.\n" +"impl Library {\n" +" fn new() -> Library {\n" +" todo!(\"Initialize and return a `Library` value\")\n" +" }\n" +"\n" +" //fn len(self) -> usize {\n" +" // todo!(\"Return the length of `self.books`\")\n" +" //}\n" +"\n" +" //fn is_empty(self) -> bool {\n" +" // todo!(\"Return `true` if `self.books` is empty\")\n" +" //}\n" +"\n" +" //fn add_book(self, book: Book) {\n" +" // todo!(\"Add a new book to `self.books`\")\n" +" //}\n" +"\n" +" //fn print_books(self) {\n" +" // todo!(\"Iterate over `self.books` and each book's title and " +"year\")\n" +" //}\n" +"\n" +" //fn oldest_book(self) -> Option<&Book> {\n" +" // todo!(\"Return a reference to the oldest book (if any)\")\n" +" //}\n" +"}\n" +"\n" +"// This shows the desired behavior. Uncomment the code below and\n" +"// implement the missing methods. You will need to update the\n" +"// method signatures, including the \"self\" parameter! You may\n" +"// also need to update the variable bindings within main.\n" +"fn main() {\n" +" let library = Library::new();\n" +"\n" +" //println!(\"The library is empty: library.is_empty() -> {}\", library." +"is_empty());\n" +" //\n" +" //library.add_book(Book::new(\"Lord of the Rings\", 1954));\n" +" //library.add_book(Book::new(\"Alice's Adventures in Wonderland\", " +"1865));\n" +" //\n" +" //println!(\"The library is no longer empty: library.is_empty() -> {}\", " +"library.is_empty());\n" +" //\n" +" //\n" +" //library.print_books();\n" +" //\n" +" //match library.oldest_book() {\n" +" // Some(book) => println!(\"The oldest book is {}\", book.title),\n" +" // None => println!(\"The library is empty!\"),\n" +" //}\n" +" //\n" +" //println!(\"The library has {} books\", library.len());\n" +" //library.print_books();\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/day-2/book-library.md:102 +#, fuzzy +msgid "[Solution](solutions-afternoon.md#designing-a-library)" +msgstr "[Solution](solutions-afternoon.md#designing-a-library)" #: src/exercises/day-2/health-statistics.md:3 #, fuzzy @@ -7567,11 +8099,25 @@ msgid "" "pub struct User {\n" " name: String,\n" " age: u32,\n" -" weight: f32,\n" +" height: f32,\n" +" visit_count: usize,\n" +" last_blood_pressure: Option<(u32, u32)>,\n" +"}\n" +"\n" +"pub struct Measurements {\n" +" height: f32,\n" +" blood_pressure: (u32, u32),\n" +"}\n" +"\n" +"pub struct HealthReport<'a> {\n" +" patient_name: &'a str,\n" +" visit_count: u32,\n" +" height_change: f32,\n" +" blood_pressure_change: Option<(i32, i32)>,\n" "}\n" "\n" "impl User {\n" -" pub fn new(name: String, age: u32, weight: f32) -> Self {\n" +" pub fn new(name: String, age: u32, height: f32) -> Self {\n" " unimplemented!()\n" " }\n" "\n" @@ -7583,7 +8129,11 @@ msgid "" " unimplemented!()\n" " }\n" "\n" -" pub fn weight(&self) -> f32 {\n" +" pub fn height(&self) -> f32 {\n" +" unimplemented!()\n" +" }\n" +"\n" +" pub fn doctor_visits(&self) -> u32 {\n" " unimplemented!()\n" " }\n" "\n" @@ -7591,7 +8141,12 @@ msgid "" " unimplemented!()\n" " }\n" "\n" -" pub fn set_weight(&mut self, new_weight: f32) {\n" +" pub fn set_height(&mut self, new_height: f32) {\n" +" unimplemented!()\n" +" }\n" +"\n" +" pub fn visit_doctor(&mut self, measurements: Measurements) -> " +"HealthReport {\n" " unimplemented!()\n" " }\n" "}\n" @@ -7602,9 +8157,9 @@ msgid "" "}\n" "\n" "#[test]\n" -"fn test_weight() {\n" +"fn test_height() {\n" " let bob = User::new(String::from(\"Bob\"), 32, 155.2);\n" -" assert_eq!(bob.weight(), 155.2);\n" +" assert_eq!(bob.height(), 155.2);\n" "}\n" "\n" "#[test]\n" @@ -7614,738 +8169,30 @@ msgid "" " bob.set_age(33);\n" " assert_eq!(bob.age(), 33);\n" "}\n" -"```" -msgstr "" - -#: src/exercises/day-2/points-polygons.md:1 -#, fuzzy -msgid "Polygon Struct" -msgstr "Structure Polygone" - -#: src/exercises/day-2/points-polygons.md:3 -#, fuzzy -msgid "" -"We will create a `Polygon` struct which contain some points. Copy the code " -"below to and fill in the missing methods to " -"make the tests pass:" -msgstr "" -"Nous allons créer une structure `Polygon` contenant des points. Copiez le " -"code ci-dessous à et remplissez les méthodes " -"manquantes pour faire le les tests passent :" - -#: src/exercises/day-2/points-polygons.md:7 -msgid "" -"```rust\n" -"// TODO: remove this when you're done with your implementation.\n" -"#![allow(unused_variables, dead_code)]\n" "\n" -"pub struct Point {\n" -" // add fields\n" -"}\n" +"#[test]\n" +"fn test_visit() {\n" +" let mut bob = User::new(String::from(\"Bob\"), 32, 155.2);\n" +" assert_eq!(bob.doctor_visits(), 0);\n" +" let report = bob.visit_doctor(Measurements {\n" +" height: 156.1,\n" +" blood_pressure: (120, 80),\n" +" });\n" +" assert_eq!(report.patient_name, \"Bob\");\n" +" assert_eq!(report.visit_count, 1);\n" +" assert_eq!(report.blood_pressure_change, None);\n" "\n" -"impl Point {\n" -" // add methods\n" -"}\n" +" let report = bob.visit_doctor(Measurements {\n" +" height: 156.1,\n" +" blood_pressure: (115, 76),\n" +" });\n" "\n" -"pub struct Polygon {\n" -" // add fields\n" -"}\n" -"\n" -"impl Polygon {\n" -" // add methods\n" -"}\n" -"\n" -"pub struct Circle {\n" -" // add fields\n" -"}\n" -"\n" -"impl Circle {\n" -" // add methods\n" -"}\n" -"\n" -"pub enum Shape {\n" -" Polygon(Polygon),\n" -" Circle(Circle),\n" -"}\n" -"\n" -"#[cfg(test)]\n" -"mod tests {\n" -" use super::*;\n" -"\n" -" fn round_two_digits(x: f64) -> f64 {\n" -" (x * 100.0).round() / 100.0\n" -" }\n" -"\n" -" #[test]\n" -" fn test_point_magnitude() {\n" -" let p1 = Point::new(12, 13);\n" -" assert_eq!(round_two_digits(p1.magnitude()), 17.69);\n" -" }\n" -"\n" -" #[test]\n" -" fn test_point_dist() {\n" -" let p1 = Point::new(10, 10);\n" -" let p2 = Point::new(14, 13);\n" -" assert_eq!(round_two_digits(p1.dist(p2)), 5.00);\n" -" }\n" -"\n" -" #[test]\n" -" fn test_point_add() {\n" -" let p1 = Point::new(16, 16);\n" -" let p2 = p1 + Point::new(-4, 3);\n" -" assert_eq!(p2, Point::new(12, 19));\n" -" }\n" -"\n" -" #[test]\n" -" fn test_polygon_left_most_point() {\n" -" let p1 = Point::new(12, 13);\n" -" let p2 = Point::new(16, 16);\n" -"\n" -" let mut poly = Polygon::new();\n" -" poly.add_point(p1);\n" -" poly.add_point(p2);\n" -" assert_eq!(poly.left_most_point(), Some(p1));\n" -" }\n" -"\n" -" #[test]\n" -" fn test_polygon_iter() {\n" -" let p1 = Point::new(12, 13);\n" -" let p2 = Point::new(16, 16);\n" -"\n" -" let mut poly = Polygon::new();\n" -" poly.add_point(p1);\n" -" poly.add_point(p2);\n" -"\n" -" let points = poly.iter().cloned().collect::>();\n" -" assert_eq!(points, vec![Point::new(12, 13), Point::new(16, 16)]);\n" -" }\n" -"\n" -" #[test]\n" -" fn test_shape_perimeters() {\n" -" let mut poly = Polygon::new();\n" -" poly.add_point(Point::new(12, 13));\n" -" poly.add_point(Point::new(17, 11));\n" -" poly.add_point(Point::new(16, 16));\n" -" let shapes = vec![\n" -" Shape::from(poly),\n" -" Shape::from(Circle::new(Point::new(10, 20), 5)),\n" -" ];\n" -" let perimeters = shapes\n" -" .iter()\n" -" .map(Shape::perimeter)\n" -" .map(round_two_digits)\n" -" .collect::>();\n" -" assert_eq!(perimeters, vec![15.48, 31.42]);\n" -" }\n" -"}\n" -"\n" -"#[allow(dead_code)]\n" -"fn main() {}\n" -"```" -msgstr "" - -#: src/exercises/day-2/points-polygons.md:117 -#, fuzzy -msgid "" -"Since the method signatures are missing from the problem statements, the key " -"part of the exercise is to specify those correctly. You don't have to modify " -"the tests." -msgstr "" -"Étant donné que les signatures de méthode manquent dans les énoncés de " -"problème, la partie clé de l'exercice consiste à les spécifier correctement. " -"Vous n'avez pas à modifier les tests." - -#: src/exercises/day-2/points-polygons.md:120 -#, fuzzy -msgid "Other interesting parts of the exercise:" -msgstr "Autres parties intéressantes de l'exercice :" - -#: src/exercises/day-2/points-polygons.md:122 -#, fuzzy -msgid "" -"Derive a `Copy` trait for some structs, as in tests the methods sometimes " -"don't borrow their arguments." -msgstr "" -"Dérivez un trait `Copy` pour certaines structures, car dans les tests, les " -"méthodes n'empruntent parfois pas leurs arguments." - -#: src/exercises/day-2/points-polygons.md:123 -#, fuzzy -msgid "" -"Discover that `Add` trait must be implemented for two objects to be addable " -"via \"+\". Note that we do not discuss generics until Day 3." -msgstr "" -"Découvrez que le trait `Add` doit être implémenté pour que deux objets " -"puissent être ajoutés via \"+\". Notez que nous ne discutons pas des " -"génériques avant le Jour 3." - -#: src/control-flow.md:3 -#, fuzzy -msgid "" -"As we have seen, `if` is an expression in Rust. It is used to conditionally " -"evaluate one of two blocks, but the blocks can have a value which then " -"becomes the value of the `if` expression. Other control flow expressions " -"work similarly in Rust." -msgstr "" -"Comme nous l'avons vu, `if` est une expression en Rust. Il est utilisé pour " -"conditionnellement évaluer l'un des deux blocs, mais les blocs peuvent avoir " -"une valeur qui devient alors la valeur de l'expression \"if\". D'autres " -"expressions de flux de contrôle fonctionnent de manière similaire à Rust." - -#: src/control-flow/blocks.md:3 -#, fuzzy -msgid "" -"A block in Rust contains a sequence of expressions. Each block has a value " -"and a type, which are those of the last expression of the block:" -msgstr "" -"Un bloc en Rust a une valeur et un type : la valeur est la dernière " -"expression du bloc:" - -#: src/control-flow/blocks.md:7 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let x = {\n" -" let y = 10;\n" -" println!(\"y: {y}\");\n" -" let z = {\n" -" let w = {\n" -" 3 + 4\n" -" };\n" -" println!(\"w: {w}\");\n" -" y * w\n" -" };\n" -" println!(\"z: {z}\");\n" -" z - y\n" -" };\n" -" println!(\"x: {x}\");\n" +" assert_eq!(report.visit_count, 2);\n" +" assert_eq!(report.blood_pressure_change, Some((-5, -4)));\n" "}\n" "```" msgstr "" -#: src/control-flow/blocks.md:26 -msgid "" -"If the last expression ends with `;`, then the resulting value and type is " -"`()`." -msgstr "" - -#: src/control-flow/blocks.md:28 -#, fuzzy -msgid "" -"The same rule is used for functions: the value of the function body is the " -"return value:" -msgstr "" -"La même règle est utilisée pour les fonctions : la valeur du corps de la " -"fonction est le valeur de retour :" - -#: src/control-flow/blocks.md:31 -msgid "" -"```rust,editable\n" -"fn double(x: i32) -> i32 {\n" -" x + x\n" -"}\n" -"\n" -"fn main() {\n" -" println!(\"doubled: {}\", double(7));\n" -"}\n" -"```" -msgstr "" - -#: src/control-flow/blocks.md:44 -#, fuzzy -msgid "" -"The point of this slide is to show that blocks have a type and value in " -"Rust. " -msgstr "" -"Le but de cette diapositive est de montrer que les blocs ont un type et une " -"valeur dans Rust." - -#: src/control-flow/blocks.md:45 -#, fuzzy -msgid "" -"You can show how the value of the block changes by changing the last line in " -"the block. For instance, adding/removing a semicolon or using a `return`." -msgstr "" -"Vous pouvez montrer comment la valeur du bloc change en modifiant la " -"dernière ligne du bloc. Par exemple, ajouter/supprimer un point-virgule ou " -"utiliser un \"retour\"." - -#: src/control-flow/if-expressions.md:1 -#, fuzzy -msgid "`if` expressions" -msgstr "expressions \"si\"" - -#: src/control-flow/if-expressions.md:3 -msgid "" -"You use [`if` expressions](https://doc.rust-lang.org/reference/expressions/" -"if-expr.html#if-expressions) exactly like `if` statements in other languages:" -msgstr "" - -#: src/control-flow/if-expressions.md:7 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let mut x = 10;\n" -" if x % 2 == 0 {\n" -" x = x / 2;\n" -" } else {\n" -" x = 3 * x + 1;\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/control-flow/if-expressions.md:18 -#, fuzzy -msgid "" -"In addition, you can use `if` as an expression. The last expression of each " -"block becomes the value of the `if` expression:" -msgstr "" -"De plus, vous pouvez l'utiliser comme expression. Cela fait la même chose " -"que ci-dessus:" - -#: src/control-flow/if-expressions.md:22 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let mut x = 10;\n" -" x = if x % 2 == 0 {\n" -" x / 2\n" -" } else {\n" -" 3 * x + 1\n" -" };\n" -"}\n" -"```" -msgstr "" - -#: src/control-flow/if-expressions.md:35 -msgid "" -"Because `if` is an expression and must have a particular type, both of its " -"branch blocks must have the same type. Consider showing what happens if you " -"add `;` after `x / 2` in the second example." -msgstr "" - -#: src/control-flow/if-let-expressions.md:1 -#, fuzzy -msgid "`if let` expressions" -msgstr "expressions `si nous allons`" - -#: src/control-flow/if-let-expressions.md:3 -msgid "" -"The [`if let` expression](https://doc.rust-lang.org/reference/expressions/if-" -"expr.html#if-let-expressions) lets you execute different code depending on " -"whether a value matches a pattern:" -msgstr "" - -#: src/control-flow/if-let-expressions.md:7 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let arg = std::env::args().next();\n" -" if let Some(value) = arg {\n" -" println!(\"Program name: {value}\");\n" -" } else {\n" -" println!(\"Missing name?\");\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/control-flow/if-let-expressions.md:18 -#: src/control-flow/while-let-expressions.md:21 -#: src/control-flow/match-expressions.md:23 -#, fuzzy -msgid "" -"See [pattern matching](../pattern-matching.md) for more details on patterns " -"in Rust." -msgstr "" -"Voir [pattern matching](../pattern-matching.md) pour plus de détails sur les " -"modèles dans Rouiller." - -#: src/control-flow/if-let-expressions.md:23 -msgid "" -"Unlike `match`, `if let` does not have to cover all branches. This can make " -"it more concise than `match`." -msgstr "" - -#: src/control-flow/if-let-expressions.md:24 -msgid "A common usage is handling `Some` values when working with `Option`." -msgstr "" - -#: src/control-flow/if-let-expressions.md:25 -msgid "" -"Unlike `match`, `if let` does not support guard clauses for pattern matching." -msgstr "" - -#: src/control-flow/if-let-expressions.md:26 -msgid "" -"Since 1.65, a similar [let-else](https://doc.rust-lang.org/rust-by-example/" -"flow_control/let_else.html) construct allows to do a destructuring " -"assignment, or if it fails, execute a block which is required to abort " -"normal control flow (with `panic`/`return`/`break`/`continue`):" -msgstr "" - -#: src/control-flow/if-let-expressions.md:28 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" println!(\"{:?}\", second_word_to_upper(\"foo bar\"));\n" -"}\n" -" \n" -"fn second_word_to_upper(s: &str) -> Option {\n" -" let mut it = s.split(' ');\n" -" let (Some(_), Some(item)) = (it.next(), it.next()) else {\n" -" return None;\n" -" };\n" -" Some(item.to_uppercase())\n" -"}\n" -"```" -msgstr "" - -#: src/control-flow/while-expressions.md:1 -#, fuzzy -msgid "`while` loops" -msgstr "Expressions `while`" - -#: src/control-flow/while-expressions.md:3 -msgid "" -"The [`while` keyword](https://doc.rust-lang.org/reference/expressions/loop-" -"expr.html#predicate-loops) works very similar to other languages:" -msgstr "" - -#: src/control-flow/while-expressions.md:6 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let mut x = 10;\n" -" while x != 1 {\n" -" x = if x % 2 == 0 {\n" -" x / 2\n" -" } else {\n" -" 3 * x + 1\n" -" };\n" -" }\n" -" println!(\"Final x: {x}\");\n" -"}\n" -"```" -msgstr "" - -#: src/control-flow/while-let-expressions.md:1 -#, fuzzy -msgid "`while let` loops" -msgstr "expressions `while let`" - -#: src/control-flow/while-let-expressions.md:3 -#, fuzzy -msgid "" -"Like with `if let`, there is a [`while let`](https://doc.rust-lang.org/" -"reference/expressions/loop-expr.html#predicate-pattern-loops) variant which " -"repeatedly tests a value against a pattern:" -msgstr "" -"Comme avec `if`, il existe une variante `while let` qui teste à plusieurs " -"reprises une valeur contre un modèle :" - -#: src/control-flow/while-let-expressions.md:6 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let v = vec![10, 20, 30];\n" -" let mut iter = v.into_iter();\n" -"\n" -" while let Some(x) = iter.next() {\n" -" println!(\"x: {x}\");\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/control-flow/while-let-expressions.md:17 -#, fuzzy -msgid "" -"Here the iterator returned by `v.iter()` will return a `Option` on " -"every call to `next()`. It returns `Some(x)` until it is done, after which " -"it will return `None`. The `while let` lets us keep iterating through all " -"items." -msgstr "" -"Ici, l'itérateur renvoyé par `v.iter()` renverra une `Option` à chaque " -"appel à `next()`. Il renvoie `Some(x)` jusqu'à ce qu'il soit terminé, après " -"quoi il renvoie \"Aucun\". Le `while let` nous permet de continuer à " -"parcourir tous les éléments." - -#: src/control-flow/while-let-expressions.md:26 -#, fuzzy -msgid "" -"Point out that the `while let` loop will keep going as long as the value " -"matches the pattern." -msgstr "" -"Soulignez que la boucle `while let` continuera tant que la valeur correspond " -"au modèle." - -#: src/control-flow/while-let-expressions.md:27 -#, fuzzy -msgid "" -"You could rewrite the `while let` loop as an infinite loop with an if " -"statement that breaks when there is no value to unwrap for `iter.next()`. " -"The `while let` provides syntactic sugar for the above scenario." -msgstr "" -"Vous pouvez réécrire la boucle `while let` comme une boucle infinie avec une " -"instruction if qui s'interrompt lorsqu'il n'y a pas de valeur à déballer " -"pour `iter.next()`. Le `while let` fournit du sucre syntaxique pour le " -"scénario ci-dessus." - -#: src/control-flow/for-expressions.md:1 -#, fuzzy -msgid "`for` loops" -msgstr "Boucles `for`" - -#: src/control-flow/for-expressions.md:3 -#, fuzzy -msgid "" -"The [`for` loop](https://doc.rust-lang.org/std/keyword.for.html) is closely " -"related to the [`while let` loop](while-let-expressions.md). It will " -"automatically call `into_iter()` on the expression and then iterate over it:" -msgstr "" -"L'expression `for` est étroitement liée à l'expression `while let`. Ce sera " -"appelez automatiquement `into_iter()` sur l'expression, puis parcourez-la :" - -#: src/control-flow/for-expressions.md:7 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let v = vec![10, 20, 30];\n" -"\n" -" for x in v {\n" -" println!(\"x: {x}\");\n" -" }\n" -" \n" -" for i in (0..10).step_by(2) {\n" -" println!(\"i: {i}\");\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/control-flow/for-expressions.md:21 -#, fuzzy -msgid "You can use `break` and `continue` here as usual." -msgstr "Vous pouvez utiliser `break` et `continue` ici comme d'habitude." - -#: src/control-flow/for-expressions.md:25 -#, fuzzy -msgid "Index iteration is not a special syntax in Rust for just that case." -msgstr "" -"L'itération d'index n'est pas une syntaxe spéciale dans Rust pour ce cas " -"précis." - -#: src/control-flow/for-expressions.md:26 -#, fuzzy -msgid "`(0..10)` is a range that implements an `Iterator` trait. " -msgstr "`(0..10)` est une plage qui implémente un trait `Iterator`." - -#: src/control-flow/for-expressions.md:27 -#, fuzzy -msgid "" -"`step_by` is a method that returns another `Iterator` that skips every other " -"element. " -msgstr "" -"`step_by` est une méthode qui renvoie un autre `Iterator` qui saute tous les " -"autres éléments." - -#: src/control-flow/for-expressions.md:28 -#, fuzzy -msgid "" -"Modify the elements in the vector and explain the compiler errors. Change " -"vector `v` to be mutable and the for loop to `for x in v.iter_mut()`." -msgstr "" -"Modifier les éléments du vecteur et expliquer les erreurs du compilateur. " -"Modifiez le vecteur `v` pour qu'il soit modifiable et la boucle for en `for " -"x in v.iter_mut()`." - -#: src/control-flow/loop-expressions.md:1 -#, fuzzy -msgid "`loop` expressions" -msgstr "\\# expressions de \"boucle\"" - -#: src/control-flow/loop-expressions.md:3 -msgid "" -"Finally, there is a [`loop` keyword](https://doc.rust-lang.org/reference/" -"expressions/loop-expr.html#infinite-loops) which creates an endless loop." -msgstr "" - -#: src/control-flow/loop-expressions.md:6 -#, fuzzy -msgid "Here you must either `break` or `return` to stop the loop:" -msgstr "" -"Enfin, il existe un mot-clé `loop` qui crée une boucle sans fin. Ici, vous " -"devez soit `break` ou `return` pour arrêter la boucle :" - -#: src/control-flow/loop-expressions.md:8 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let mut x = 10;\n" -" loop {\n" -" x = if x % 2 == 0 {\n" -" x / 2\n" -" } else {\n" -" 3 * x + 1\n" -" };\n" -" if x == 1 {\n" -" break;\n" -" }\n" -" }\n" -" println!(\"Final x: {x}\");\n" -"}\n" -"```" -msgstr "" - -#: src/control-flow/loop-expressions.md:27 -msgid "Break the `loop` with a value (e.g. `break 8`) and print it out." -msgstr "" - -#: src/control-flow/loop-expressions.md:28 -msgid "" -"Note that `loop` is the only looping construct which returns a non-trivial " -"value. This is because it's guaranteed to be entered at least once (unlike " -"`while` and `for` loops)." -msgstr "" - -#: src/control-flow/match-expressions.md:1 -#, fuzzy -msgid "`match` expressions" -msgstr "expressions \"correspondantes\"" - -#: src/control-flow/match-expressions.md:3 -#, fuzzy -msgid "" -"The [`match` keyword](https://doc.rust-lang.org/reference/expressions/match-" -"expr.html) is used to match a value against one or more patterns. In that " -"sense, it works like a series of `if let` expressions:" -msgstr "" -"Le mot clé `match` est utilisé pour faire correspondre une valeur à un ou " -"plusieurs modèles. Dans en ce sens, cela fonctionne comme une série " -"d'expressions \"if let\":" - -#: src/control-flow/match-expressions.md:7 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" match std::env::args().next().as_deref() {\n" -" Some(\"cat\") => println!(\"Will do cat things\"),\n" -" Some(\"ls\") => println!(\"Will ls some files\"),\n" -" Some(\"mv\") => println!(\"Let's move some files\"),\n" -" Some(\"rm\") => println!(\"Uh, dangerous!\"),\n" -" None => println!(\"Hmm, no program name?\"),\n" -" _ => println!(\"Unknown program name!\"),\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/control-flow/match-expressions.md:20 -#, fuzzy -msgid "" -"Like `if let`, each match arm must have the same type. The type is the last " -"expression of the block, if any. In the example above, the type is `()`." -msgstr "" -"Comme `if let`, chaque bras de correspondance doit avoir le même type. Le " -"type est le dernier expression du bloc, le cas échéant. Dans l'exemple ci-" -"dessus, le type est `()`." - -#: src/control-flow/match-expressions.md:28 -#, fuzzy -msgid "Save the match expression to a variable and print it out." -msgstr "" -"Enregistrez l'expression de correspondance dans une variable et imprimez-la." - -#: src/control-flow/match-expressions.md:29 -#, fuzzy -msgid "Remove `.as_deref()` and explain the error." -msgstr "Supprimez `.as_deref()` et expliquez l'erreur." - -#: src/control-flow/match-expressions.md:30 -#, fuzzy -msgid "" -"`std::env::args().next()` returns an `Option`, but we cannot match " -"against `String`." -msgstr "" -"`std::env::args().next()` renvoie une `Option`, mais nous ne pouvons " -"pas comparer `String`." - -#: src/control-flow/match-expressions.md:31 -#, fuzzy -msgid "" -"`as_deref()` transforms an `Option` to `Option<&T::Target>`. In our case, " -"this turns `Option` into `Option<&str>`." -msgstr "" -"`as_deref()` transforme une `Option` en `Option<&T::Target>`. Dans notre " -"cas, cela transforme `Option` en `Option<&str>`." - -#: src/control-flow/match-expressions.md:32 -#, fuzzy -msgid "" -"We can now use pattern matching to match against the `&str` inside `Option`." -msgstr "" -"Nous pouvons maintenant utiliser le pattern matching pour faire correspondre " -"le `&str` à l'intérieur de `Option`." - -#: src/control-flow/break-continue.md:1 -#, fuzzy -msgid "`break` and `continue`" -msgstr "`pause` et `continue`" - -#: src/control-flow/break-continue.md:3 -msgid "" -"If you want to exit a loop early, use [`break`](https://doc.rust-lang.org/" -"reference/expressions/loop-expr.html#break-expressions)," -msgstr "" - -#: src/control-flow/break-continue.md:4 -msgid "" -"If you want to immediately start the next iteration use [`continue`](https://" -"doc.rust-lang.org/reference/expressions/loop-expr.html#continue-expressions)." -msgstr "" - -#: src/control-flow/break-continue.md:7 -#, fuzzy -msgid "" -"Both `continue` and `break` can optionally take a label argument which is " -"used to break out of nested loops:" -msgstr "" -"Si vous voulez quitter une boucle plus tôt, utilisez `break`, si vous voulez " -"commencer immédiatement la prochaine itération utilise `continue`. " -"`continue` et `break` peuvent éventuellement prenez un argument d'étiquette " -"qui est utilisé pour sortir des boucles imbriquées :" - -#: src/control-flow/break-continue.md:10 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let v = vec![10, 20, 30];\n" -" let mut iter = v.into_iter();\n" -" 'outer: while let Some(x) = iter.next() {\n" -" println!(\"x: {x}\");\n" -" let mut i = 0;\n" -" while i < x {\n" -" println!(\"x: {x}, i: {i}\");\n" -" i += 1;\n" -" if i == 3 {\n" -" break 'outer;\n" -" }\n" -" }\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/control-flow/break-continue.md:28 -#, fuzzy -msgid "" -"In this case we break the outer loop after 3 iterations of the inner loop." -msgstr "" -"Dans ce cas, nous cassons la boucle externe après 3 itérations de la boucle " -"interne." - #: src/std.md:3 #, fuzzy msgid "" @@ -8811,6 +8658,14 @@ msgid "" "compiles. Where do you think we might run into issues?" msgstr "" +#: src/std/hashmap.md:64 +msgid "" +"This type has several \"method-specific\" return types, such as `std::" +"collections::hash_map::Keys`. These types often appear in searches of the " +"Rust docs. Show students the docs for this type, and the helpful link back " +"to the `keys` method." +msgstr "" + #: src/std/box.md:1 #, fuzzy msgid "`Box`" @@ -9054,24 +8909,14 @@ msgstr "" #: src/std/rc.md:18 #, fuzzy msgid "" -"If you need to mutate the data inside an `Rc`, you will need to wrap the " -"data in a type such as [`Cell` or `RefCell`](../concurrency/shared_state/arc." -"md)." -msgstr "" -"Si vous avez besoin de muter les données à l'intérieur d'un `Rc`, vous " -"devrez envelopper les données dans un type tel que [`Cell` ou `RefCell`](../" -"concurrency/shared_state/arc.md)." - -#: src/std/rc.md:20 -#, fuzzy -msgid "" -"See [`Arc`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) if you are " -"in a multi-threaded context." +"See [`Arc`](../concurrency/shared_state/arc.md) and [`Mutex`](https://doc." +"rust-lang.org/std/sync/struct.Mutex.html) if you are in a multi-threaded " +"context." msgstr "" "Voir [`Arc`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) si vous " "êtes dans un contexte multi-thread." -#: src/std/rc.md:21 +#: src/std/rc.md:19 #, fuzzy msgid "" "You can _downgrade_ a shared pointer into a [`Weak`](https://doc.rust-lang." @@ -9081,7 +8926,7 @@ msgstr "" "(https://doc.rust-lang.org/std/rc/struct.Weak.html) pour créer des cycles " "qui va tomber." -#: src/std/rc.md:31 +#: src/std/rc.md:29 #, fuzzy msgid "" "`Rc`'s count ensures that its contained value is valid for as long as there " @@ -9090,12 +8935,12 @@ msgstr "" "Le comptage de `Rc` garantit que sa valeur contenue est valide tant qu'il y " "a des références." -#: src/std/rc.md:32 +#: src/std/rc.md:30 #, fuzzy msgid "`Rc` in Rust is like `std::shared_ptr` in C++." msgstr "Comme `std::shared_ptr` de C++." -#: src/std/rc.md:33 +#: src/std/rc.md:31 #, fuzzy msgid "" "`Rc::clone` is cheap: it creates a pointer to the same allocation and " @@ -9107,7 +8952,7 @@ msgstr "" "généralement être ignoré lors de la recherche de problèmes de performances " "dans le code." -#: src/std/rc.md:34 +#: src/std/rc.md:32 #, fuzzy msgid "" "`make_mut` actually clones the inner value if necessary (\"clone-on-write\") " @@ -9116,64 +8961,109 @@ msgstr "" "`make_mut` clone en fait la valeur interne si nécessaire (\"clone-on-" "write\") et renvoie une référence mutable." -#: src/std/rc.md:35 +#: src/std/rc.md:33 #, fuzzy msgid "Use `Rc::strong_count` to check the reference count." msgstr "Utilisez `Rc::strong_count` pour vérifier le nombre de références." -#: src/std/rc.md:36 -#, fuzzy -msgid "" -"Compare the different datatypes mentioned. `Box` enables (im)mutable borrows " -"that are enforced at compile time. `RefCell` enables (im)mutable borrows " -"that are enforced at run time and will panic if it fails at runtime." -msgstr "" -"Comparez les différents types de données mentionnés. `Box` active les " -"emprunts (im)mutables qui sont appliqués au moment de la compilation. " -"`RefCell` active les emprunts (im)mutables qui sont appliqués au moment de " -"l'exécution et paniqueront s'ils échouent au moment de l'exécution." - -#: src/std/rc.md:37 +#: src/std/rc.md:34 #, fuzzy msgid "" "`Rc::downgrade` gives you a _weakly reference-counted_ object to create " -"cycles that will be dropped properly (likely in combination with `RefCell`)." +"cycles that will be dropped properly (likely in combination with `RefCell`, " +"on the next slide)." msgstr "" "Vous pouvez `downgrader()` un `Rc` en un objet _faiblement compté en " "référence_ pour créer des cycles qui seront supprimés correctement " "(probablement en combinaison avec `RefCell`)." -#: src/std/rc.md:41 +#: src/std/cell.md:1 +msgid "`Cell` and `RefCell`" +msgstr "" + +#: src/std/cell.md:3 +#, fuzzy +msgid "" +"[`Cell`](https://doc.rust-lang.org/std/cell/struct.Cell.html) and [`RefCell`]" +"(https://doc.rust-lang.org/std/cell/struct.RefCell.html) implement what Rust " +"calls _interior mutability:_ mutation of values in an immutable context." +msgstr "" +"En utilisant [`Read`](https://doc.rust-lang.org/std/io/trait.Read.html) et " +"[`BufRead`](https://doc.rust-lang.org/std/io/trait.BufRead.html), vous " +"pouvez résumer les sources `u8` :" + +#: src/std/cell.md:8 +msgid "" +"`Cell` is typically used for simple types, as it requires copying or moving " +"values. More complex interior types typically use `RefCell`, which tracks " +"shared and exclusive references at runtime and panics if they are misused." +msgstr "" + +#: src/std/cell.md:12 msgid "" "```rust,editable\n" -"use std::rc::{Rc, Weak};\n" "use std::cell::RefCell;\n" +"use std::rc::Rc;\n" "\n" -"#[derive(Debug)]\n" +"#[derive(Debug, Default)]\n" "struct Node {\n" " value: i64,\n" -" parent: Option>>,\n" " children: Vec>>,\n" "}\n" "\n" +"impl Node {\n" +" fn new(value: i64) -> Rc> {\n" +" Rc::new(RefCell::new(Node { value, ..Node::default() }))\n" +" }\n" +"\n" +" fn sum(&self) -> i64 {\n" +" self.value + self.children.iter().map(|c| c.borrow().sum()).sum::" +"()\n" +" }\n" +"}\n" +"\n" "fn main() {\n" -" let mut root = Rc::new(RefCell::new(Node {\n" -" value: 42,\n" -" parent: None,\n" -" children: vec![],\n" -" }));\n" -" let child = Rc::new(RefCell::new(Node {\n" -" value: 43,\n" -" children: vec![],\n" -" parent: Some(Rc::downgrade(&root))\n" -" }));\n" -" root.borrow_mut().children.push(child);\n" +" let root = Node::new(1);\n" +" root.borrow_mut().children.push(Node::new(5));\n" +" let subtree = Node::new(10);\n" +" subtree.borrow_mut().children.push(Node::new(11));\n" +" subtree.borrow_mut().children.push(Node::new(12));\n" +" root.borrow_mut().children.push(subtree);\n" "\n" " println!(\"graph: {root:#?}\");\n" +" println!(\"graph sum: {}\", root.borrow().sum());\n" "}\n" "```" msgstr "" +#: src/std/cell.md:47 +msgid "" +"If we were using `Cell` instead of `RefCell` in this example, we would have " +"to move the `Node` out of the `Rc` to push children, then move it back in. " +"This is safe because there's always one, un-referenced value in the cell, " +"but it's not ergonomic." +msgstr "" + +#: src/std/cell.md:48 +msgid "" +"To do anything with a Node, you must call a `RefCell` method, usually " +"`borrow` or `borrow_mut`." +msgstr "" + +#: src/std/cell.md:49 +msgid "" +"Demonstrate that reference loops can be created by adding `root` to `subtree." +"children` (don't try to print it!)." +msgstr "" + +#: src/std/cell.md:50 +msgid "" +"To demonstrate a runtime panic, add a `fn inc(&mut self)` that increments " +"`self.value` and calls the same method on its children. This will panic in " +"the presence of the reference loop, with `thread 'main' panicked at 'already " +"borrowed: BorrowMutError'`." +msgstr "" + #: src/modules.md:3 #, fuzzy msgid "We have seen how `impl` blocks let us namespace functions to a type." @@ -9385,9 +9275,9 @@ msgid "" msgstr "" #: src/modules/filesystem.md:3 -#, fuzzy -msgid "The module content can be omitted:" -msgstr "Le contenu du module peut être omis :" +msgid "" +"Omitting the module content will tell Rust to look for it in another file:" +msgstr "" #: src/modules/filesystem.md:5 msgid "" @@ -9397,51 +9287,28 @@ msgid "" msgstr "" #: src/modules/filesystem.md:9 -#, fuzzy -msgid "The `garden` module content is found at:" -msgstr "Le contenu du module \"jardin\" se trouve à :" - -#: src/modules/filesystem.md:11 -#, fuzzy -msgid "`src/garden.rs` (modern Rust 2018 style)" -msgstr "`src/garden.rs` (style Rust 2018 moderne)" +msgid "" +"This tells rust that the `garden` module content is found at `src/garden." +"rs`. Similarly, a `garden::vegetables` module can be found at `src/garden/" +"vegetables.rs`." +msgstr "" #: src/modules/filesystem.md:12 #, fuzzy -msgid "`src/garden/mod.rs` (older Rust 2015 style)" -msgstr "`src/garden/mod.rs` (ancien style Rust 2015)" - -#: src/modules/filesystem.md:14 -#, fuzzy -msgid "Similarly, a `garden::vegetables` module can be found at:" -msgstr "De même, un module `garden::legumes` peut être trouvé à :" - -#: src/modules/filesystem.md:16 -#, fuzzy -msgid "`src/garden/vegetables.rs` (modern Rust 2018 style)" -msgstr "`src/garden/vegetables.rs` (style Rust 2018 moderne)" - -#: src/modules/filesystem.md:17 -#, fuzzy -msgid "`src/garden/vegetables/mod.rs` (older Rust 2015 style)" -msgstr "`src/garden/vegetables/mod.rs` (ancien style Rust 2015)" - -#: src/modules/filesystem.md:19 -#, fuzzy msgid "The `crate` root is in:" msgstr "La racine `crate` se trouve dans :" -#: src/modules/filesystem.md:21 +#: src/modules/filesystem.md:14 #, fuzzy msgid "`src/lib.rs` (for a library crate)" msgstr "`src/lib.rs` (pour une caisse de bibliothèque)" -#: src/modules/filesystem.md:22 +#: src/modules/filesystem.md:15 #, fuzzy msgid "`src/main.rs` (for a binary crate)" msgstr "`src/main.rs` (pour un crate binaire)" -#: src/modules/filesystem.md:24 +#: src/modules/filesystem.md:17 #, fuzzy msgid "" "Modules defined in files can be documented, too, using \"inner doc " @@ -9452,7 +9319,7 @@ msgstr "" "l'aide de \"commentaires de documentation internes\". Ceux-ci documentent " "l'élément qui les contient -- dans ce cas, un module." -#: src/modules/filesystem.md:27 +#: src/modules/filesystem.md:20 msgid "" "```rust,editable,compile_fail\n" "//! This module implements the garden, including a highly performant " @@ -9471,17 +9338,23 @@ msgid "" "```" msgstr "" -#: src/modules/filesystem.md:44 +#: src/modules/filesystem.md:37 msgid "" -"The change from `module/mod.rs` to `module.rs` doesn't preclude the use of " -"submodules in Rust 2018. (It was mandatory in Rust 2015.)" +"Before Rust 2018, modules needed to be located at `module/mod.rs` instead of " +"`module.rs`, and this is still a working alternative for editions after 2018." msgstr "" -#: src/modules/filesystem.md:47 -msgid "The following is valid:" +#: src/modules/filesystem.md:39 +msgid "" +"The main reason to introduce `filename.rs` as alternative to `filename/mod." +"rs` was because many files named `mod.rs` can be hard to distinguish in IDEs." msgstr "" -#: src/modules/filesystem.md:49 +#: src/modules/filesystem.md:42 +msgid "Deeper nesting can use folders, even if the main module is a file:" +msgstr "" + +#: src/modules/filesystem.md:44 msgid "" "```ignore\n" "src/\n" @@ -9492,27 +9365,21 @@ msgid "" "```" msgstr "" -#: src/modules/filesystem.md:57 +#: src/modules/filesystem.md:52 msgid "" -"The main reason for the change is to prevent many files named `mod.rs`, " -"which can be hard to distinguish in IDEs." +"The place rust will look for modules can be changed with a compiler " +"directive:" msgstr "" -#: src/modules/filesystem.md:60 -msgid "" -"Rust will look for modules in `modulename/mod.rs` and `modulename.rs`, but " -"this can be changed with a compiler directive:" -msgstr "" - -#: src/modules/filesystem.md:63 +#: src/modules/filesystem.md:54 msgid "" "```rust,ignore\n" "#[path = \"some/path.rs\"]\n" -"mod some_module { }\n" +"mod some_module;\n" "```" msgstr "" -#: src/modules/filesystem.md:68 +#: src/modules/filesystem.md:59 msgid "" "This is useful, for example, if you would like to place tests for a module " "in a file named `some_module_test.rs`, similar to the convention in Go." @@ -9529,114 +9396,217 @@ msgid "The exercises for this afternoon will focus on strings and iterators." msgstr "" "Les exercices de cet après-midi porteront sur les chaînes et les itérateurs." -#: src/exercises/day-2/luhn.md:3 +#: src/exercises/day-2/iterators-and-ownership.md:3 #, fuzzy msgid "" -"The [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) is used " -"to validate credit card numbers. The algorithm takes a string as input and " -"does the following to validate the credit card number:" +"The ownership model of Rust affects many APIs. An example of this is the " +"[`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) and " +"[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html) " +"traits." msgstr "" -"L'[algorithme de Luhn](https://en.wikipedia.org/wiki/Luhn_algorithm) est " -"utilisé pour valider les numéros de carte de crédit. L'algorithme prend une " -"chaîne en entrée et fait le suivant pour valider le numéro de carte " -"bancaire :" +"Le modèle de propriété de Rust affecte de nombreuses API. Un exemple en est " +"le [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) et " +"[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html) " +"caractéristiques." -#: src/exercises/day-2/luhn.md:7 +#: src/exercises/day-2/iterators-and-ownership.md:8 src/bare-metal/no_std.md:28 #, fuzzy -msgid "Ignore all spaces. Reject number with less than two digits." -msgstr "" -"Ignorer tous les espaces. Numéro de rejet comportant moins de deux chiffres." +msgid "`Iterator`" +msgstr "`Itérateur`" -#: src/exercises/day-2/luhn.md:9 +#: src/exercises/day-2/iterators-and-ownership.md:10 #, fuzzy msgid "" -"Moving from right to left, double every second digit: for the number `1234`, " -"we double `3` and `1`." +"Traits are like interfaces: they describe behavior (methods) for a type. The " +"`Iterator` trait simply says that you can call `next` until you get `None` " +"back:" msgstr "" -"En se déplaçant de droite à gauche, doubler tous les deux chiffres : pour le " -"nombre `1234`, on double '3' et '1'." +"Les traits sont comme des interfaces : ils décrivent le comportement " +"(méthodes) d'un type. Le Le trait `Iterator` indique simplement que vous " +"pouvez appeler `next` jusqu'à ce que vous obteniez `None` :" -#: src/exercises/day-2/luhn.md:12 -#, fuzzy -msgid "" -"After doubling a digit, sum the digits. So doubling `7` becomes `14` which " -"becomes `5`." -msgstr "" -"Après avoir doublé un chiffre, additionnez les chiffres. Donc doubler '7' " -"devient '14' ce qui devient '5'." - -#: src/exercises/day-2/luhn.md:15 -#, fuzzy -msgid "Sum all the undoubled and doubled digits." -msgstr "Additionnez tous les chiffres non doublés et doublés." - -#: src/exercises/day-2/luhn.md:17 -#, fuzzy -msgid "The credit card number is valid if the sum ends with `0`." -msgstr "" -"Le numéro de carte de crédit est valide si la somme se termine par '0'." - -#: src/exercises/day-2/luhn.md:19 -#, fuzzy -msgid "" -"Copy the following code to and implement the " -"function:" -msgstr "" -"Copiez le code suivant sur et implémentez le " -"fonction:" - -#: src/exercises/day-2/luhn.md:23 +#: src/exercises/day-2/iterators-and-ownership.md:13 msgid "" "```rust\n" -"// TODO: remove this when you're done with your implementation.\n" -"#![allow(unused_variables, dead_code)]\n" -"\n" -"pub fn luhn(cc_number: &str) -> bool {\n" -" unimplemented!()\n" +"pub trait Iterator {\n" +" type Item;\n" +" fn next(&mut self) -> Option;\n" "}\n" -"\n" -"#[test]\n" -"fn test_non_digit_cc_number() {\n" -" assert!(!luhn(\"foo\"));\n" -"}\n" -"\n" -"#[test]\n" -"fn test_empty_cc_number() {\n" -" assert!(!luhn(\"\"));\n" -" assert!(!luhn(\" \"));\n" -" assert!(!luhn(\" \"));\n" -" assert!(!luhn(\" \"));\n" -"}\n" -"\n" -"#[test]\n" -"fn test_single_digit_cc_number() {\n" -" assert!(!luhn(\"0\"));\n" -"}\n" -"\n" -"#[test]\n" -"fn test_two_digit_cc_number() {\n" -" assert!(luhn(\" 0 0 \"));\n" -"}\n" -"\n" -"#[test]\n" -"fn test_valid_cc_number() {\n" -" assert!(luhn(\"4263 9826 4026 9299\"));\n" -" assert!(luhn(\"4539 3195 0343 6467\"));\n" -" assert!(luhn(\"7992 7398 713\"));\n" -"}\n" -"\n" -"#[test]\n" -"fn test_invalid_cc_number() {\n" -" assert!(!luhn(\"4223 9826 4026 9299\"));\n" -" assert!(!luhn(\"4539 3195 0343 6476\"));\n" -" assert!(!luhn(\"8273 1232 7352 0569\"));\n" -"}\n" -"\n" -"#[allow(dead_code)]\n" -"fn main() {}\n" "```" msgstr "" +#: src/exercises/day-2/iterators-and-ownership.md:20 +#, fuzzy +msgid "You use this trait like this:" +msgstr "Vous utilisez ce trait comme ceci :" + +#: src/exercises/day-2/iterators-and-ownership.md:22 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let v: Vec = vec![10, 20, 30];\n" +" let mut iter = v.iter();\n" +"\n" +" println!(\"v[0]: {:?}\", iter.next());\n" +" println!(\"v[1]: {:?}\", iter.next());\n" +" println!(\"v[2]: {:?}\", iter.next());\n" +" println!(\"No more items: {:?}\", iter.next());\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:34 +#, fuzzy +msgid "What is the type returned by the iterator? Test your answer here:" +msgstr "Quel est le type retourné par l'itérateur ? Testez votre réponse ici :" + +#: src/exercises/day-2/iterators-and-ownership.md:36 +msgid "" +"```rust,editable,compile_fail\n" +"fn main() {\n" +" let v: Vec = vec![10, 20, 30];\n" +" let mut iter = v.iter();\n" +"\n" +" let v0: Option<..> = iter.next();\n" +" println!(\"v0: {v0:?}\");\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:46 +#, fuzzy +msgid "Why is this type used?" +msgstr "Pourquoi ce type est-il utilisé ?" + +#: src/exercises/day-2/iterators-and-ownership.md:48 +#, fuzzy +msgid "`IntoIterator`" +msgstr "`IntoIterator`" + +#: src/exercises/day-2/iterators-and-ownership.md:50 +#, fuzzy +msgid "" +"The `Iterator` trait tells you how to _iterate_ once you have created an " +"iterator. The related trait `IntoIterator` tells you how to create the " +"iterator:" +msgstr "" +"Le trait `Iterator` vous indique comment _itérer_ une fois que vous avez " +"créé un itérateur. Le trait connexe \"IntoIterator\" vous indique comment " +"créer l'itérateur :" + +#: src/exercises/day-2/iterators-and-ownership.md:53 +msgid "" +"```rust\n" +"pub trait IntoIterator {\n" +" type Item;\n" +" type IntoIter: Iterator;\n" +"\n" +" fn into_iter(self) -> Self::IntoIter;\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:62 +#, fuzzy +msgid "" +"The syntax here means that every implementation of `IntoIterator` must " +"declare two types:" +msgstr "" +"La syntaxe ici signifie que chaque implémentation de `IntoIterator` doit " +"déclarer deux types :" + +#: src/exercises/day-2/iterators-and-ownership.md:65 +#, fuzzy +msgid "`Item`: the type we iterate over, such as `i8`," +msgstr "`Item` : le type sur lequel nous itérons, tel que `i8`," + +#: src/exercises/day-2/iterators-and-ownership.md:66 +#, fuzzy +msgid "`IntoIter`: the `Iterator` type returned by the `into_iter` method." +msgstr "`IntoIter` : le type `Iterator` renvoyé par la méthode `into_iter`." + +#: src/exercises/day-2/iterators-and-ownership.md:68 +#, fuzzy +msgid "" +"Note that `IntoIter` and `Item` are linked: the iterator must have the same " +"`Item` type, which means that it returns `Option`" +msgstr "" +"Notez que `IntoIter` et `Item` sont liés : l'itérateur doit avoir le même " +"Type `Item`, ce qui signifie qu'il renvoie `Option`" + +#: src/exercises/day-2/iterators-and-ownership.md:71 +#, fuzzy +msgid "Like before, what is the type returned by the iterator?" +msgstr "Comme précédemment, quel est le type retourné par l'itérateur ?" + +#: src/exercises/day-2/iterators-and-ownership.md:73 +msgid "" +"```rust,editable,compile_fail\n" +"fn main() {\n" +" let v: Vec = vec![String::from(\"foo\"), String::" +"from(\"bar\")];\n" +" let mut iter = v.into_iter();\n" +"\n" +" let v0: Option<..> = iter.next();\n" +" println!(\"v0: {v0:?}\");\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:83 +#, fuzzy +msgid "`for` Loops" +msgstr "Boucles `for`" + +#: src/exercises/day-2/iterators-and-ownership.md:85 +#, fuzzy +msgid "" +"Now that we know both `Iterator` and `IntoIterator`, we can build `for` " +"loops. They call `into_iter()` on an expression and iterates over the " +"resulting iterator:" +msgstr "" +"Maintenant que nous connaissons à la fois `Iterator` et `IntoIterator`, nous " +"pouvons construire des boucles `for`. Ils appellent `into_iter()` sur une " +"expression et itèrent sur le résultat itérateur :" + +#: src/exercises/day-2/iterators-and-ownership.md:89 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let v: Vec = vec![String::from(\"foo\"), String::" +"from(\"bar\")];\n" +"\n" +" for word in &v {\n" +" println!(\"word: {word}\");\n" +" }\n" +"\n" +" for word in v {\n" +" println!(\"word: {word}\");\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:103 +#, fuzzy +msgid "What is the type of `word` in each loop?" +msgstr "Quel est le type de \"mot\" dans chaque boucle ?" + +#: src/exercises/day-2/iterators-and-ownership.md:105 +#, fuzzy +msgid "" +"Experiment with the code above and then consult the documentation for [`impl " +"IntoIterator for &Vec`](https://doc.rust-lang.org/std/vec/struct.Vec." +"html#impl-IntoIterator-for-%26'a+Vec%3CT,+A%3E) and [`impl IntoIterator for " +"Vec`](https://doc.rust-lang.org/std/vec/struct.Vec.html#impl-IntoIterator-" +"for-Vec%3CT,+A%3E) to check your answers." +msgstr "" +"Expérimentez avec le code ci-dessus, puis consultez la documentation de " +"[`impl IntoIterator pour &Vec`](https://doc.rust-lang.org/std/vec/struct." +"Vec.html#impl-IntoIterator-for-%26%27a%20Vec%3CT%2C%20A%3E) et [`impl " +"IntoIterator for Vec`](https://doc.rust-lang.org/std/vec/struct.Vec." +"html#impl-IntoIterator-for-Vec%3CT%2C%20A%3E) pour vérifier vos réponses." + #: src/exercises/day-2/strings-iterators.md:3 #, fuzzy msgid "" @@ -10103,12 +10073,18 @@ msgid "" msgstr "" #: src/traits/deriving-traits.md:3 +msgid "" +"Rust derive macros work by automatically generating code that implements the " +"specified traits for a data structure." +msgstr "" + +#: src/traits/deriving-traits.md:5 #, fuzzy -msgid "You can let the compiler derive a number of traits:" +msgid "You can let the compiler derive a number of traits as follows:" msgstr "" "Vous pouvez laisser le compilateur dériver un certain nombre de traits :" -#: src/traits/deriving-traits.md:5 +#: src/traits/deriving-traits.md:7 msgid "" "```rust,editable\n" "#[derive(Debug, Clone, PartialEq, Eq, Default)]\n" @@ -10138,9 +10114,9 @@ msgstr "" msgid "" "```rust,editable\n" "trait Equals {\n" -" fn equal(&self, other: &Self) -> bool;\n" -" fn not_equal(&self, other: &Self) -> bool {\n" -" !self.equal(other)\n" +" fn equals(&self, other: &Self) -> bool;\n" +" fn not_equals(&self, other: &Self) -> bool {\n" +" !self.equals(other)\n" " }\n" "}\n" "\n" @@ -10148,7 +10124,7 @@ msgid "" "struct Centimeter(i16);\n" "\n" "impl Equals for Centimeter {\n" -" fn equal(&self, other: &Centimeter) -> bool {\n" +" fn equals(&self, other: &Centimeter) -> bool {\n" " self.0 == other.0\n" " }\n" "}\n" @@ -10156,8 +10132,8 @@ msgid "" "fn main() {\n" " let a = Centimeter(10);\n" " let b = Centimeter(20);\n" -" println!(\"{a:?} equals {b:?}: {}\", a.equal(&b));\n" -" println!(\"{a:?} not_equals {b:?}: {}\", a.not_equal(&b));\n" +" println!(\"{a:?} equals {b:?}: {}\", a.equals(&b));\n" +" println!(\"{a:?} not_equals {b:?}: {}\", a.not_equals(&b));\n" "}\n" "```" msgstr "" @@ -10176,21 +10152,21 @@ msgstr "" #: src/traits/default-methods.md:35 #, fuzzy -msgid "Move method `not_equal` to a new trait `NotEqual`." +msgid "Move method `not_equals` to a new trait `NotEquals`." msgstr "Déplacez la méthode `not_equal` vers un nouveau trait `NotEqual`." #: src/traits/default-methods.md:37 #, fuzzy -msgid "Make `Equals` a super trait for `NotEqual`." +msgid "Make `Equals` a super trait for `NotEquals`." msgstr "Faites de `NotEqual` un super trait pour `Equal`." #: src/traits/default-methods.md:38 #, fuzzy msgid "" "```rust,editable,compile_fail\n" -"trait NotEqual: Equals {\n" -" fn not_equal(&self, other: &Self) -> bool {\n" -" !self.equal(other)\n" +"trait NotEquals: Equals {\n" +" fn not_equals(&self, other: &Self) -> bool {\n" +" !self.equals(other)\n" " }\n" "}\n" "```" @@ -10198,25 +10174,26 @@ msgstr "Fournir une implémentation globale de `NotEqual` pour `Equal`." #: src/traits/default-methods.md:46 #, fuzzy -msgid "Provide a blanket implementation of `NotEqual` for `Equal`." +msgid "Provide a blanket implementation of `NotEquals` for `Equals`." msgstr "" "Avec l'implémentation globale, vous n'avez plus besoin de `NotEqual` comme " "super trait pour `Equal`." #: src/traits/default-methods.md:47 +#, fuzzy msgid "" "```rust,editable,compile_fail\n" -"trait NotEqual {\n" -" fn not_equal(&self, other: &Self) -> bool;\n" +"trait NotEquals {\n" +" fn not_equals(&self, other: &Self) -> bool;\n" "}\n" "\n" -"impl NotEqual for T where T: Equals {\n" -" fn not_equal(&self, other: &Self) -> bool {\n" -" !self.equal(other)\n" +"impl NotEquals for T where T: Equals {\n" +" fn not_equals(&self, other: &Self) -> bool {\n" +" !self.equals(other)\n" " }\n" "}\n" "```" -msgstr "" +msgstr "Fournir une implémentation globale de `NotEqual` pour `Equal`." #: src/traits/default-methods.md:58 msgid "" @@ -10838,12 +10815,12 @@ msgid "" "}\n" "\n" "fn main() {\n" -" let default_struct: Derived = Default::default();\n" +" let default_struct = Derived::default();\n" " println!(\"{default_struct:#?}\");\n" "\n" " let almost_default_struct = Derived {\n" " y: \"Y is set!\".into(),\n" -" ..Default::default()\n" +" ..Derived::default()\n" " };\n" " println!(\"{almost_default_struct:#?}\");\n" "\n" @@ -10902,6 +10879,13 @@ msgstr "" "La bibliothèque standard Rust est consciente que les types peuvent " "implémenter `Default` et fournit des méthodes pratiques qui l'utilisent." +#: src/traits/default.md:46 +msgid "" +"the `..` syntax is called [struct update syntax](https://doc.rust-lang.org/" +"book/ch05-01-defining-structs.html#creating-instances-from-other-instances-" +"with-struct-update-syntax)" +msgstr "" + #: src/traits/operators.md:1 #, fuzzy msgid "`Add`, `Mul`, ..." @@ -11101,11 +11085,17 @@ msgstr "Jour 3 : Exercices du matin" #: src/exercises/day-3/morning.md:3 #, fuzzy -msgid "We will design a classical GUI library traits and trait objects." +msgid "We will design a classical GUI library using traits and trait objects." msgstr "" "Nous allons concevoir une bibliothèque de traits et d'objets de traits " "d'interface graphique classique." +#: src/exercises/day-3/morning.md:5 +msgid "" +"We will also look at enum dispatch with an exercise involving points and " +"polygons." +msgstr "" + #: src/exercises/day-3/simple-gui.md:3 #, fuzzy msgid "" @@ -11338,6 +11328,168 @@ msgid "" "```" msgstr "" +#: src/exercises/day-3/points-polygons.md:1 +#, fuzzy +msgid "Polygon Struct" +msgstr "Structure Polygone" + +#: src/exercises/day-3/points-polygons.md:3 +#, fuzzy +msgid "" +"We will create a `Polygon` struct which contain some points. Copy the code " +"below to and fill in the missing methods to " +"make the tests pass:" +msgstr "" +"Nous allons créer une structure `Polygon` contenant des points. Copiez le " +"code ci-dessous à et remplissez les méthodes " +"manquantes pour faire le les tests passent :" + +#: src/exercises/day-3/points-polygons.md:7 +msgid "" +"```rust\n" +"// TODO: remove this when you're done with your implementation.\n" +"#![allow(unused_variables, dead_code)]\n" +"\n" +"pub struct Point {\n" +" // add fields\n" +"}\n" +"\n" +"impl Point {\n" +" // add methods\n" +"}\n" +"\n" +"pub struct Polygon {\n" +" // add fields\n" +"}\n" +"\n" +"impl Polygon {\n" +" // add methods\n" +"}\n" +"\n" +"pub struct Circle {\n" +" // add fields\n" +"}\n" +"\n" +"impl Circle {\n" +" // add methods\n" +"}\n" +"\n" +"pub enum Shape {\n" +" Polygon(Polygon),\n" +" Circle(Circle),\n" +"}\n" +"\n" +"#[cfg(test)]\n" +"mod tests {\n" +" use super::*;\n" +"\n" +" fn round_two_digits(x: f64) -> f64 {\n" +" (x * 100.0).round() / 100.0\n" +" }\n" +"\n" +" #[test]\n" +" fn test_point_magnitude() {\n" +" let p1 = Point::new(12, 13);\n" +" assert_eq!(round_two_digits(p1.magnitude()), 17.69);\n" +" }\n" +"\n" +" #[test]\n" +" fn test_point_dist() {\n" +" let p1 = Point::new(10, 10);\n" +" let p2 = Point::new(14, 13);\n" +" assert_eq!(round_two_digits(p1.dist(p2)), 5.00);\n" +" }\n" +"\n" +" #[test]\n" +" fn test_point_add() {\n" +" let p1 = Point::new(16, 16);\n" +" let p2 = p1 + Point::new(-4, 3);\n" +" assert_eq!(p2, Point::new(12, 19));\n" +" }\n" +"\n" +" #[test]\n" +" fn test_polygon_left_most_point() {\n" +" let p1 = Point::new(12, 13);\n" +" let p2 = Point::new(16, 16);\n" +"\n" +" let mut poly = Polygon::new();\n" +" poly.add_point(p1);\n" +" poly.add_point(p2);\n" +" assert_eq!(poly.left_most_point(), Some(p1));\n" +" }\n" +"\n" +" #[test]\n" +" fn test_polygon_iter() {\n" +" let p1 = Point::new(12, 13);\n" +" let p2 = Point::new(16, 16);\n" +"\n" +" let mut poly = Polygon::new();\n" +" poly.add_point(p1);\n" +" poly.add_point(p2);\n" +"\n" +" let points = poly.iter().cloned().collect::>();\n" +" assert_eq!(points, vec![Point::new(12, 13), Point::new(16, 16)]);\n" +" }\n" +"\n" +" #[test]\n" +" fn test_shape_perimeters() {\n" +" let mut poly = Polygon::new();\n" +" poly.add_point(Point::new(12, 13));\n" +" poly.add_point(Point::new(17, 11));\n" +" poly.add_point(Point::new(16, 16));\n" +" let shapes = vec![\n" +" Shape::from(poly),\n" +" Shape::from(Circle::new(Point::new(10, 20), 5)),\n" +" ];\n" +" let perimeters = shapes\n" +" .iter()\n" +" .map(Shape::perimeter)\n" +" .map(round_two_digits)\n" +" .collect::>();\n" +" assert_eq!(perimeters, vec![15.48, 31.42]);\n" +" }\n" +"}\n" +"\n" +"#[allow(dead_code)]\n" +"fn main() {}\n" +"```" +msgstr "" + +#: src/exercises/day-3/points-polygons.md:117 +#, fuzzy +msgid "" +"Since the method signatures are missing from the problem statements, the key " +"part of the exercise is to specify those correctly. You don't have to modify " +"the tests." +msgstr "" +"Étant donné que les signatures de méthode manquent dans les énoncés de " +"problème, la partie clé de l'exercice consiste à les spécifier correctement. " +"Vous n'avez pas à modifier les tests." + +#: src/exercises/day-3/points-polygons.md:120 +#, fuzzy +msgid "Other interesting parts of the exercise:" +msgstr "Autres parties intéressantes de l'exercice :" + +#: src/exercises/day-3/points-polygons.md:122 +#, fuzzy +msgid "" +"Derive a `Copy` trait for some structs, as in tests the methods sometimes " +"don't borrow their arguments." +msgstr "" +"Dérivez un trait `Copy` pour certaines structures, car dans les tests, les " +"méthodes n'empruntent parfois pas leurs arguments." + +#: src/exercises/day-3/points-polygons.md:123 +#, fuzzy +msgid "" +"Discover that `Add` trait must be implemented for two objects to be addable " +"via \"+\". Note that we do not discuss generics until Day 3." +msgstr "" +"Découvrez que le trait `Add` doit être implémenté pour que deux objets " +"puissent être ajoutés via \"+\". Notez que nous ne discutons pas des " +"génériques avant le Jour 3." + #: src/error-handling.md:3 #, fuzzy msgid "Error handling in Rust is done using explicit control flow:" @@ -11588,6 +11740,24 @@ msgstr "" "Utilisez l'appel `fs::write` pour tester les différents scénarios : pas de " "fichier, fichier vide, fichier avec nom d'utilisateur." +#: src/error-handling/try-operator.md:52 +msgid "" +"The return type of the function has to be compatible with the nested " +"functions it calls. For instance, a function returning a `Result` " +"can only apply the `?` operator on a function returning a `Result`. It cannot apply the `?` operator on a function returning an " +"`Option` or `Result` unless `OtherErr` implements " +"`From`. Reciprocally, a function returning an `Option` can only " +"apply the `?` operator on a function returning an `Option`." +msgstr "" + +#: src/error-handling/try-operator.md:57 +msgid "" +"You can convert incompatible types into one another with the different " +"`Option` and `Result` methods such as `Option::ok_or`, `Result::ok`, " +"`Result::err`." +msgstr "" + #: src/error-handling/converting-error-types.md:3 #, fuzzy msgid "" @@ -11678,13 +11848,19 @@ msgid "" msgstr "" #: src/error-handling/converting-error-types-example.md:55 +msgid "" +"It is good practice for all error types that don't need to be `no_std` to " +"implement `std::error::Error`, which requires `Debug` and `Display`. The " +"`Error` crate for `core` is only available in [nightly](https://github.com/" +"rust-lang/rust/issues/103765), so not fully `no_std` compatible yet." +msgstr "" + +#: src/error-handling/converting-error-types-example.md:57 #, fuzzy msgid "" -"It is good practice for all error types to implement `std::error::Error`, " -"which requires `Debug` and `Display`. It's generally helpful for them to " -"implement `Clone` and `Eq` too where possible, to make life easier for tests " -"and consumers of your library. In this case we can't easily do so, because " -"`io::Error` doesn't implement them." +"It's generally helpful for them to implement `Clone` and `Eq` too where " +"possible, to make life easier for tests and consumers of your library. In " +"this case we can't easily do so, because `io::Error` doesn't implement them." msgstr "" "C'est une bonne pratique pour tous les types d'erreurs d'implémenter `std::" "error::Error`, qui nécessite `Debug` et 'Affichage'. Il est généralement " @@ -12910,9 +13086,9 @@ msgstr "" #: src/android/setup.md:6 msgid "" "```shell\n" -"$ source build/envsetup.sh\n" -"$ lunch aosp_cf_x86_64_phone-userdebug\n" -"$ acloud create\n" +"source build/envsetup.sh\n" +"lunch aosp_cf_x86_64_phone-userdebug\n" +"acloud create\n" "```" msgstr "" @@ -13100,9 +13276,15 @@ msgstr "Vous pouvez maintenant compiler, envoyer et exécuter le binaire :" #: src/android/build-rules/binary.md:29 msgid "" "```shell\n" -"$ m hello_rust\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust /data/local/tmp\"\n" -"$ adb shell /data/local/tmp/hello_rust\n" +"m hello_rust\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust /data/local/tmp\"\n" +"adb shell /data/local/tmp/hello_rust\n" +"```" +msgstr "" + +#: src/android/build-rules/binary.md:35 +msgid "" +"```text\n" "Hello from Rust!\n" "```" msgstr "" @@ -13201,10 +13383,16 @@ msgstr "Vous construisez, poussez et exécutez le binaire comme avant :" #: src/android/build-rules/library.md:61 msgid "" "```shell\n" -"$ m hello_rust_with_dep\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_with_dep /data/local/" +"m hello_rust_with_dep\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_with_dep /data/local/" "tmp\"\n" -"$ adb shell /data/local/tmp/hello_rust_with_dep\n" +"adb shell /data/local/tmp/hello_rust_with_dep\n" +"```" +msgstr "" + +#: src/android/build-rules/library.md:67 +msgid "" +"```text\n" "Hello Bob, it is very\n" "nice to meet you!\n" "```" @@ -13417,10 +13605,10 @@ msgstr "Nous pouvons maintenant créer, pousser et démarrer le service :" #: src/android/aidl/deploy.md:5 msgid "" "```shell\n" -"$ m birthday_server\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server /data/local/" +"m birthday_server\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server /data/local/" "tmp\"\n" -"$ adb shell /data/local/tmp/birthday_server\n" +"adb shell /data/local/tmp/birthday_server\n" "```" msgstr "" @@ -13432,20 +13620,32 @@ msgstr "Dans un autre terminal, vérifiez que le service s'exécute :" #: src/android/aidl/deploy.md:13 msgid "" "```shell\n" -"$ adb shell service check birthdayservice\n" +"adb shell service check birthdayservice\n" +"```" +msgstr "" + +#: src/android/aidl/deploy.md:17 +msgid "" +"```text\n" "Service birthdayservice: found\n" "```" msgstr "" -#: src/android/aidl/deploy.md:18 +#: src/android/aidl/deploy.md:21 #, fuzzy msgid "You can also call the service with `service call`:" msgstr "Vous pouvez également appeler le service avec `service call` :" -#: src/android/aidl/deploy.md:20 +#: src/android/aidl/deploy.md:23 msgid "" "```shell\n" -"$ $ adb shell service call birthdayservice 1 s16 Bob i32 24\n" +"adb shell service call birthdayservice 1 s16 Bob i32 24\n" +"```" +msgstr "" + +#: src/android/aidl/deploy.md:27 +msgid "" +"```text\n" "Result: Parcel(\n" " 0x00000000: 00000000 00000036 00610048 00700070 '....6...H.a.p.p.'\n" " 0x00000010: 00200079 00690042 00740072 00640068 'y. .B.i.r.t.h.d.'\n" @@ -13538,10 +13738,16 @@ msgstr "Créez, transférez et exécutez le client sur votre appareil :" #: src/android/aidl/client.md:56 msgid "" "```shell\n" -"$ m birthday_client\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_client /data/local/" +"m birthday_client\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_client /data/local/" "tmp\"\n" -"$ adb shell /data/local/tmp/birthday_client Charlie 60\n" +"adb shell /data/local/tmp/birthday_client Charlie 60\n" +"```" +msgstr "" + +#: src/android/aidl/client.md:62 +msgid "" +"```text\n" "Happy Birthday Charlie, congratulations with the 60 years!\n" "```" msgstr "" @@ -13634,10 +13840,10 @@ msgstr "Compilez, transférez et exécutez le binaire sur votre appareil :" #: src/android/logging.md:44 msgid "" "```shell\n" -"$ m hello_rust_logs\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs /data/local/" +"m hello_rust_logs\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs /data/local/" "tmp\"\n" -"$ adb shell /data/local/tmp/hello_rust_logs\n" +"adb shell /data/local/tmp/hello_rust_logs\n" "```" msgstr "" @@ -13649,7 +13855,13 @@ msgstr "Les journaux s'affichent dans `adb logcat` :" #: src/android/logging.md:52 msgid "" "```shell\n" -"$ adb logcat -s rust\n" +"adb logcat -s rust\n" +"```" +msgstr "" + +#: src/android/logging.md:56 +msgid "" +"```text\n" "09-08 08:38:32.454 2420 2420 D rust: hello_rust_logs: Starting program.\n" "09-08 08:38:32.454 2420 2420 I rust: hello_rust_logs: Things are going " "fine.\n" @@ -13908,10 +14120,10 @@ msgstr "" #: src/android/interoperability/with-c/bindgen.md:100 msgid "" "```shell\n" -"$ m print_birthday_card\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/print_birthday_card /data/local/" +"m print_birthday_card\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/print_birthday_card /data/local/" "tmp\"\n" -"$ adb shell /data/local/tmp/print_birthday_card\n" +"adb shell /data/local/tmp/print_birthday_card\n" "```" msgstr "" @@ -13940,7 +14152,7 @@ msgstr "" #: src/android/interoperability/with-c/bindgen.md:122 msgid "" "```shell\n" -"$ atest libbirthday_bindgen_test\n" +"atest libbirthday_bindgen_test\n" "```" msgstr "" @@ -14057,10 +14269,10 @@ msgstr "" #: src/android/interoperability/with-c/rust.md:75 msgid "" "```shell\n" -"$ m analyze_numbers\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/analyze_numbers /data/local/" +"m analyze_numbers\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/analyze_numbers /data/local/" "tmp\"\n" -"$ adb shell /data/local/tmp/analyze_numbers\n" +"adb shell /data/local/tmp/analyze_numbers\n" "```" msgstr "" @@ -14099,6 +14311,42 @@ msgstr "" "Voir le \\[tutoriel CXX\\] [2](https://cxx.rs/tutorial.html) pour un exemple " "complet d'utilisation." +#: src/android/interoperability/cpp.md:14 +msgid "" +"At this point, the instructor should switch to the [CXX tutorial](https://" +"cxx.rs/tutorial.html)." +msgstr "" + +#: src/android/interoperability/cpp.md:16 +msgid "Walk the students through the tutorial step by step." +msgstr "" + +#: src/android/interoperability/cpp.md:18 +msgid "" +"Highlight how CXX presents a clean interface without unsafe code in _both " +"languages_." +msgstr "" + +#: src/android/interoperability/cpp.md:20 +msgid "" +"Show the correspondence between [Rust and C++ types](https://cxx.rs/bindings." +"html):" +msgstr "" + +#: src/android/interoperability/cpp.md:22 +msgid "" +"Explain how a Rust `String` cannot map to a C++ `std::string` (the latter " +"does not uphold the UTF-8 invariant). Show that despite being different " +"types, `rust::String` in C++ can be easily constructed from a C++ `std::" +"string`, making it very ergonomic to use." +msgstr "" + +#: src/android/interoperability/cpp.md:28 +msgid "" +"Explain that a Rust function returning `Result` becomes a function " +"which throws a `E` exception in C++ (and vice versa)." +msgstr "" + #: src/android/interoperability/java.md:1 #, fuzzy msgid "Interoperability with Java" @@ -14215,9 +14463,9 @@ msgstr "Enfin, vous pouvez créer, synchroniser et exécuter le binaire :" #: src/android/interoperability/java.md:75 msgid "" "```shell\n" -"$ m helloworld_jni\n" -"$ adb sync # requires adb root && adb remount\n" -"$ adb shell /system/bin/helloworld_jni\n" +"m helloworld_jni\n" +"adb sync # requires adb root && adb remount\n" +"adb shell /system/bin/helloworld_jni\n" "```" msgstr "" @@ -15888,7 +16136,7 @@ msgstr "" msgid "" "If it were running in a VM, this can lead to cache coherency issues. The " "problem is that the VM is accessing memory directly with the cache disabled, " -"while the host has cachable aliases to the same memory. Even if the host " +"while the host has cacheable aliases to the same memory. Even if the host " "doesn't explicitly access the memory, speculative accesses can lead to cache " "fills, and then changes from one or the other will get lost when the cache " "is cleaned or the VM enables the cache. (Cache is keyed by physical address, " @@ -16737,9 +16985,9 @@ msgid "" " writeln!(uart, \"main({x0:#x}, {x1:#x}, {x2:#x}, {x3:#x})\").unwrap();\n" "\n" " loop {\n" -" if let Some(b) = uart.read_byte() {\n" -" uart.write_byte(b);\n" -" match b {\n" +" if let Some(byte) = uart.read_byte() {\n" +" uart.write_byte(byte);\n" +" match byte {\n" " b'\\r' => {\n" " uart.write_byte(b'\\n');\n" " }\n" @@ -17070,7 +17318,7 @@ msgstr "" msgid "" "If it were running in a VM, this can lead to cache coherency issues. The " "problem is that the VM is accessing memory directly with the cache disabled, " -"while the host has cachable aliases to the same memory. Even if the host " +"while the host has cacheable aliases to the same memory. Even if the host " "doesn't explicitly access the memory, speculative accesses can lead to cache " "fills, and then changes from one or the other will get lost. Again this is " "alright in this particular case (running directly on the hardware with no " @@ -18781,17 +19029,20 @@ msgid "" "```rust,editable,compile_fail\n" "use std::thread;\n" "\n" -"fn main() {\n" +"fn foo() {\n" " let s = String::from(\"Hello\");\n" -"\n" " thread::spawn(|| {\n" " println!(\"Length: {}\", s.len());\n" " });\n" "}\n" +"\n" +"fn main() {\n" +" foo();\n" +"}\n" "```" msgstr "" -#: src/concurrency/scoped-threads.md:17 +#: src/concurrency/scoped-threads.md:20 #, fuzzy msgid "" "However, you can use a [scoped thread](https://doc.rust-lang.org/std/thread/" @@ -18800,7 +19051,7 @@ msgstr "" "Cependant, vous pouvez utiliser un [fil de discussion de portée](https://doc." "rust-lang.org/std/thread/fn.scope.html) pour cela :" -#: src/concurrency/scoped-threads.md:19 +#: src/concurrency/scoped-threads.md:22 msgid "" "```rust,editable\n" "use std::thread;\n" @@ -18817,7 +19068,7 @@ msgid "" "```" msgstr "" -#: src/concurrency/scoped-threads.md:37 +#: src/concurrency/scoped-threads.md:40 #, fuzzy msgid "" "The reason for that is that when the `thread::scope` function completes, all " @@ -18827,7 +19078,7 @@ msgstr "" "les threads sont garantis d'être joints, afin qu'ils puissent renvoyer des " "données empruntées." -#: src/concurrency/scoped-threads.md:38 +#: src/concurrency/scoped-threads.md:41 #, fuzzy msgid "" "Normal Rust borrowing rules apply: you can either borrow mutably by one " @@ -19328,7 +19579,7 @@ msgstr "" #, fuzzy msgid "" "`Arc` implements `Clone` whether or not `T` does. It implements `Send` " -"and `Sync` iff `T` implements them both." +"and `Sync` if and only if `T` implements them both." msgstr "" "`Arc` implémente `Clone` que `T` le fasse ou non. Il implémente `Send` et " "`Sync` ssi `T` les met en œuvre tous les deux." @@ -19710,9 +19961,9 @@ msgstr "" #: src/exercises/concurrency/link-checker.md:11 msgid "" "```shell\n" -"$ cargo new link-checker\n" -"$ cd link-checker\n" -"$ cargo add --features blocking,rustls-tls reqwest\n" +"cargo new link-checker\n" +"cd link-checker\n" +"cargo add --features blocking,rustls-tls reqwest\n" "```" msgstr "" @@ -19738,7 +19989,7 @@ msgstr "" #: src/exercises/concurrency/link-checker.md:22 msgid "" "```shell\n" -"$ cargo add scraper\n" +"cargo add scraper\n" "```" msgstr "" @@ -19754,7 +20005,7 @@ msgstr "" #: src/exercises/concurrency/link-checker.md:29 msgid "" "```shell\n" -"$ cargo add thiserror\n" +"cargo add thiserror\n" "```" msgstr "" @@ -19800,8 +20051,7 @@ msgstr "Votre fichier `src/main.rs` devrait ressembler à ceci :" #: src/exercises/concurrency/link-checker.md:57 msgid "" "```rust,compile_fail\n" -"use reqwest::blocking::{get, Response};\n" -"use reqwest::Url;\n" +"use reqwest::{blocking::Client, Url};\n" "use scraper::{Html, Selector};\n" "use thiserror::Error;\n" "\n" @@ -19809,34 +20059,57 @@ msgid "" "enum Error {\n" " #[error(\"request error: {0}\")]\n" " ReqwestError(#[from] reqwest::Error),\n" +" #[error(\"bad http response: {0}\")]\n" +" BadResponse(String),\n" "}\n" "\n" -"fn extract_links(response: Response) -> Result, Error> {\n" -" let base_url = response.url().to_owned();\n" -" let document = response.text()?;\n" -" let html = Html::parse_document(&document);\n" -" let selector = Selector::parse(\"a\").unwrap();\n" +"#[derive(Debug)]\n" +"struct CrawlCommand {\n" +" url: Url,\n" +" extract_links: bool,\n" +"}\n" "\n" -" let mut valid_urls = Vec::new();\n" -" for element in html.select(&selector) {\n" -" if let Some(href) = element.value().attr(\"href\") {\n" -" match base_url.join(href) {\n" -" Ok(url) => valid_urls.push(url),\n" -" Err(err) => {\n" -" println!(\"On {base_url}: could not parse {href:?}: " -"{err} (ignored)\",);\n" -" }\n" +"fn visit_page(client: &Client, command: &CrawlCommand) -> Result, " +"Error> {\n" +" println!(\"Checking {:#}\", command.url);\n" +" let response = client.get(command.url.clone()).send()?;\n" +" if !response.status().is_success() {\n" +" return Err(Error::BadResponse(response.status().to_string()));\n" +" }\n" +"\n" +" let mut link_urls = Vec::new();\n" +" if !command.extract_links {\n" +" return Ok(link_urls);\n" +" }\n" +"\n" +" let base_url = response.url().to_owned();\n" +" let body_text = response.text()?;\n" +" let document = Html::parse_document(&body_text);\n" +"\n" +" let selector = Selector::parse(\"a\").unwrap();\n" +" let href_values = document\n" +" .select(&selector)\n" +" .filter_map(|element| element.value().attr(\"href\"));\n" +" for href in href_values {\n" +" match base_url.join(href) {\n" +" Ok(link_url) => {\n" +" link_urls.push(link_url);\n" +" }\n" +" Err(err) => {\n" +" println!(\"On {base_url:#}: ignored unparsable {href:?}: " +"{err}\");\n" " }\n" " }\n" " }\n" -"\n" -" Ok(valid_urls)\n" +" Ok(link_urls)\n" "}\n" "\n" "fn main() {\n" +" let client = Client::new();\n" " let start_url = Url::parse(\"https://www.google.org\").unwrap();\n" -" let response = get(start_url).unwrap();\n" -" match extract_links(response) {\n" +" let crawl_command = CrawlCommand{ url: start_url, extract_links: " +"true };\n" +" match visit_page(&client, &crawl_command) {\n" " Ok(links) => println!(\"Links: {links:#?}\"),\n" " Err(err) => println!(\"Could not extract links: {err:#}\"),\n" " }\n" @@ -19844,19 +20117,19 @@ msgid "" "```" msgstr "" -#: src/exercises/concurrency/link-checker.md:100 +#: src/exercises/concurrency/link-checker.md:120 #, fuzzy msgid "Run the code in `src/main.rs` with" msgstr "Exécutez le code dans `src/main.rs` avec" -#: src/exercises/concurrency/link-checker.md:102 +#: src/exercises/concurrency/link-checker.md:122 msgid "" "```shell\n" -"$ cargo run\n" +"cargo run\n" "```" msgstr "" -#: src/exercises/concurrency/link-checker.md:108 +#: src/exercises/concurrency/link-checker.md:128 #, fuzzy msgid "" "Use threads to check the links in parallel: send the URLs to be checked to a " @@ -19866,7 +20139,7 @@ msgstr "" "à vérifier à un channel et laissez quelques threads vérifier les URL en " "parallèle." -#: src/exercises/concurrency/link-checker.md:110 +#: src/exercises/concurrency/link-checker.md:130 #, fuzzy msgid "" "Extend this to recursively extract links from all pages on the `www.google." @@ -20074,19 +20347,19 @@ msgstr "" #: src/async/runtimes.md:7 msgid "" -"[Tokio](https://tokio.rs/) - performant, with a well-developed ecosystem of " +"[Tokio](https://tokio.rs/): performant, with a well-developed ecosystem of " "functionality like [Hyper](https://hyper.rs/) for HTTP or [Tonic](https://" "github.com/hyperium/tonic) for gRPC." msgstr "" #: src/async/runtimes.md:10 msgid "" -"[async-std](https://async.rs/) - aims to be a \"std for async\", and " -"includes a basic runtime in `async::task`." +"[async-std](https://async.rs/): aims to be a \"std for async\", and includes " +"a basic runtime in `async::task`." msgstr "" #: src/async/runtimes.md:12 -msgid "[smol](https://docs.rs/smol/latest/smol/) - simple and lightweight" +msgid "[smol](https://docs.rs/smol/latest/smol/): simple and lightweight" msgstr "" #: src/async/runtimes.md:14 @@ -20293,7 +20566,7 @@ msgid "" " println!(\"Sent {} pings so far.\", i + 1);\n" " }\n" "\n" -" std::mem::drop(sender);\n" +" drop(sender);\n" " ping_handler_task.await.expect(\"Something went wrong in ping handler " "task.\");\n" "}\n" @@ -20937,7 +21210,7 @@ msgstr "" #: src/async/pitfalls/cancellation.md:82 msgid "" -"`LinesReader` can be made cancellation-safe by makeing `buf` part of the " +"`LinesReader` can be made cancellation-safe by making `buf` part of the " "struct:" msgstr "" @@ -21209,7 +21482,7 @@ msgid "" msgstr "" #: src/exercises/concurrency/chat-app.md:59 -#: src/exercises/concurrency/solutions-afternoon.md:117 +#: src/exercises/concurrency/solutions-afternoon.md:123 #, fuzzy msgid "`src/bin/server.rs`:" msgstr "`src/main.rs` :" @@ -21257,7 +21530,7 @@ msgid "" msgstr "" #: src/exercises/concurrency/chat-app.md:102 -#: src/exercises/concurrency/solutions-afternoon.md:202 +#: src/exercises/concurrency/solutions-afternoon.md:208 #, fuzzy msgid "`src/bin/client.rs`:" msgstr "`src/main.rs` :" @@ -21300,7 +21573,7 @@ msgstr "Exécutez l'exemple avec :" #: src/exercises/concurrency/chat-app.md:130 msgid "" "```shell\n" -"$ cargo run --bin server\n" +"cargo run --bin server\n" "```" msgstr "" @@ -21312,7 +21585,7 @@ msgstr "Exécutez l'exemple avec :" #: src/exercises/concurrency/chat-app.md:136 msgid "" "```shell\n" -"$ cargo run --bin client\n" +"cargo run --bin client\n" "```" msgstr "" @@ -21848,17 +22121,130 @@ msgstr "" msgid "Day 1 Afternoon Exercises" msgstr "Exercices de l'après-midi du jour 1" -#: src/exercises/day-1/solutions-afternoon.md:3 +#: src/exercises/day-1/solutions-afternoon.md:5 +#, fuzzy +msgid "([back to exercise](luhn.md))" +msgstr "([retour à l'exercice](luhn.md))" + +#: src/exercises/day-1/solutions-afternoon.md:7 +msgid "" +"```rust\n" +"// Copyright 2022 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"// ANCHOR: luhn\n" +"pub fn luhn(cc_number: &str) -> bool {\n" +" // ANCHOR_END: luhn\n" +" let mut digits_seen = 0;\n" +" let mut sum = 0;\n" +" for (i, ch) in cc_number.chars().rev().filter(|&ch| ch != ' ')." +"enumerate() {\n" +" match ch.to_digit(10) {\n" +" Some(d) => {\n" +" sum += if i % 2 == 1 {\n" +" let dd = d * 2;\n" +" dd / 10 + dd % 10\n" +" } else {\n" +" d\n" +" };\n" +" digits_seen += 1;\n" +" }\n" +" None => return false,\n" +" }\n" +" }\n" +"\n" +" if digits_seen < 2 {\n" +" return false;\n" +" }\n" +"\n" +" sum % 10 == 0\n" +"}\n" +"\n" +"fn main() {\n" +" let cc_number = \"1234 5678 1234 5670\";\n" +" println!(\n" +" \"Is {cc_number} a valid credit card number? {}\",\n" +" if luhn(cc_number) { \"yes\" } else { \"no\" }\n" +" );\n" +"}\n" +"\n" +"// ANCHOR: unit-tests\n" +"#[test]\n" +"fn test_non_digit_cc_number() {\n" +" assert!(!luhn(\"foo\"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_empty_cc_number() {\n" +" assert!(!luhn(\"\"));\n" +" assert!(!luhn(\" \"));\n" +" assert!(!luhn(\" \"));\n" +" assert!(!luhn(\" \"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_single_digit_cc_number() {\n" +" assert!(!luhn(\"0\"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_two_digit_cc_number() {\n" +" assert!(luhn(\" 0 0 \"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_valid_cc_number() {\n" +" assert!(luhn(\"4263 9826 4026 9299\"));\n" +" assert!(luhn(\"4539 3195 0343 6467\"));\n" +" assert!(luhn(\"7992 7398 713\"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_invalid_cc_number() {\n" +" assert!(!luhn(\"4223 9826 4026 9299\"));\n" +" assert!(!luhn(\"4539 3195 0343 6476\"));\n" +" assert!(!luhn(\"8273 1232 7352 0569\"));\n" +"}\n" +"// ANCHOR_END: unit-tests\n" +"```" +msgstr "" + +#: src/exercises/day-1/solutions-afternoon.md:97 +#, fuzzy +msgid "Pattern matching" +msgstr "Correspondance de motifs" + +#: src/exercises/day-1/solutions-afternoon.md:99 +msgid "TBD." +msgstr "" + +#: src/exercises/day-2/solutions-morning.md:1 +#, fuzzy +msgid "Day 2 Morning Exercises" +msgstr "Exercices du matin du jour 2" + +#: src/exercises/day-2/solutions-morning.md:3 #, fuzzy msgid "Designing a Library" msgstr "Conception d'une bibliothèque" -#: src/exercises/day-1/solutions-afternoon.md:5 +#: src/exercises/day-2/solutions-morning.md:5 #, fuzzy msgid "([back to exercise](book-library.md))" msgstr "([retour à l'exercice](book-library.md))" -#: src/exercises/day-1/solutions-afternoon.md:7 +#: src/exercises/day-2/solutions-morning.md:7 msgid "" "```rust\n" "// Copyright 2022 Google LLC\n" @@ -22055,248 +22441,6 @@ msgid "" "```" msgstr "" -#: src/exercises/day-2/solutions-morning.md:1 -#, fuzzy -msgid "Day 2 Morning Exercises" -msgstr "Exercices du matin du jour 2" - -#: src/exercises/day-2/solutions-morning.md:5 -#, fuzzy -msgid "([back to exercise](points-polygons.md))" -msgstr "([retour à l'exercice](points-polygones.md))" - -#: src/exercises/day-2/solutions-morning.md:7 -msgid "" -"```rust\n" -"// Copyright 2022 Google LLC\n" -"//\n" -"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" -"// you may not use this file except in compliance with the License.\n" -"// You may obtain a copy of the License at\n" -"//\n" -"// http://www.apache.org/licenses/LICENSE-2.0\n" -"//\n" -"// Unless required by applicable law or agreed to in writing, software\n" -"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" -"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" -"// See the License for the specific language governing permissions and\n" -"// limitations under the License.\n" -"\n" -"#[derive(Debug, Copy, Clone, PartialEq, Eq)]\n" -"// ANCHOR: Point\n" -"pub struct Point {\n" -" // ANCHOR_END: Point\n" -" x: i32,\n" -" y: i32,\n" -"}\n" -"\n" -"// ANCHOR: Point-impl\n" -"impl Point {\n" -" // ANCHOR_END: Point-impl\n" -" pub fn new(x: i32, y: i32) -> Point {\n" -" Point { x, y }\n" -" }\n" -"\n" -" pub fn magnitude(self) -> f64 {\n" -" f64::from(self.x.pow(2) + self.y.pow(2)).sqrt()\n" -" }\n" -"\n" -" pub fn dist(self, other: Point) -> f64 {\n" -" (self - other).magnitude()\n" -" }\n" -"}\n" -"\n" -"impl std::ops::Add for Point {\n" -" type Output = Self;\n" -"\n" -" fn add(self, other: Self) -> Self::Output {\n" -" Self {\n" -" x: self.x + other.x,\n" -" y: self.y + other.y,\n" -" }\n" -" }\n" -"}\n" -"\n" -"impl std::ops::Sub for Point {\n" -" type Output = Self;\n" -"\n" -" fn sub(self, other: Self) -> Self::Output {\n" -" Self {\n" -" x: self.x - other.x,\n" -" y: self.y - other.y,\n" -" }\n" -" }\n" -"}\n" -"\n" -"// ANCHOR: Polygon\n" -"pub struct Polygon {\n" -" // ANCHOR_END: Polygon\n" -" points: Vec,\n" -"}\n" -"\n" -"// ANCHOR: Polygon-impl\n" -"impl Polygon {\n" -" // ANCHOR_END: Polygon-impl\n" -" pub fn new() -> Polygon {\n" -" Polygon { points: Vec::new() }\n" -" }\n" -"\n" -" pub fn add_point(&mut self, point: Point) {\n" -" self.points.push(point);\n" -" }\n" -"\n" -" pub fn left_most_point(&self) -> Option {\n" -" self.points.iter().min_by_key(|p| p.x).copied()\n" -" }\n" -"\n" -" pub fn iter(&self) -> impl Iterator {\n" -" self.points.iter()\n" -" }\n" -"\n" -" pub fn length(&self) -> f64 {\n" -" if self.points.is_empty() {\n" -" return 0.0;\n" -" }\n" -"\n" -" let mut result = 0.0;\n" -" let mut last_point = self.points[0];\n" -" for point in &self.points[1..] {\n" -" result += last_point.dist(*point);\n" -" last_point = *point;\n" -" }\n" -" result += last_point.dist(self.points[0]);\n" -" result\n" -" }\n" -"}\n" -"\n" -"// ANCHOR: Circle\n" -"pub struct Circle {\n" -" // ANCHOR_END: Circle\n" -" center: Point,\n" -" radius: i32,\n" -"}\n" -"\n" -"// ANCHOR: Circle-impl\n" -"impl Circle {\n" -" // ANCHOR_END: Circle-impl\n" -" pub fn new(center: Point, radius: i32) -> Circle {\n" -" Circle { center, radius }\n" -" }\n" -"\n" -" pub fn circumference(&self) -> f64 {\n" -" 2.0 * std::f64::consts::PI * f64::from(self.radius)\n" -" }\n" -"\n" -" pub fn dist(&self, other: &Self) -> f64 {\n" -" self.center.dist(other.center)\n" -" }\n" -"}\n" -"\n" -"// ANCHOR: Shape\n" -"pub enum Shape {\n" -" Polygon(Polygon),\n" -" Circle(Circle),\n" -"}\n" -"// ANCHOR_END: Shape\n" -"\n" -"impl From for Shape {\n" -" fn from(poly: Polygon) -> Self {\n" -" Shape::Polygon(poly)\n" -" }\n" -"}\n" -"\n" -"impl From for Shape {\n" -" fn from(circle: Circle) -> Self {\n" -" Shape::Circle(circle)\n" -" }\n" -"}\n" -"\n" -"impl Shape {\n" -" pub fn perimeter(&self) -> f64 {\n" -" match self {\n" -" Shape::Polygon(poly) => poly.length(),\n" -" Shape::Circle(circle) => circle.circumference(),\n" -" }\n" -" }\n" -"}\n" -"\n" -"// ANCHOR: unit-tests\n" -"#[cfg(test)]\n" -"mod tests {\n" -" use super::*;\n" -"\n" -" fn round_two_digits(x: f64) -> f64 {\n" -" (x * 100.0).round() / 100.0\n" -" }\n" -"\n" -" #[test]\n" -" fn test_point_magnitude() {\n" -" let p1 = Point::new(12, 13);\n" -" assert_eq!(round_two_digits(p1.magnitude()), 17.69);\n" -" }\n" -"\n" -" #[test]\n" -" fn test_point_dist() {\n" -" let p1 = Point::new(10, 10);\n" -" let p2 = Point::new(14, 13);\n" -" assert_eq!(round_two_digits(p1.dist(p2)), 5.00);\n" -" }\n" -"\n" -" #[test]\n" -" fn test_point_add() {\n" -" let p1 = Point::new(16, 16);\n" -" let p2 = p1 + Point::new(-4, 3);\n" -" assert_eq!(p2, Point::new(12, 19));\n" -" }\n" -"\n" -" #[test]\n" -" fn test_polygon_left_most_point() {\n" -" let p1 = Point::new(12, 13);\n" -" let p2 = Point::new(16, 16);\n" -"\n" -" let mut poly = Polygon::new();\n" -" poly.add_point(p1);\n" -" poly.add_point(p2);\n" -" assert_eq!(poly.left_most_point(), Some(p1));\n" -" }\n" -"\n" -" #[test]\n" -" fn test_polygon_iter() {\n" -" let p1 = Point::new(12, 13);\n" -" let p2 = Point::new(16, 16);\n" -"\n" -" let mut poly = Polygon::new();\n" -" poly.add_point(p1);\n" -" poly.add_point(p2);\n" -"\n" -" let points = poly.iter().cloned().collect::>();\n" -" assert_eq!(points, vec![Point::new(12, 13), Point::new(16, 16)]);\n" -" }\n" -"\n" -" #[test]\n" -" fn test_shape_perimeters() {\n" -" let mut poly = Polygon::new();\n" -" poly.add_point(Point::new(12, 13));\n" -" poly.add_point(Point::new(17, 11));\n" -" poly.add_point(Point::new(16, 16));\n" -" let shapes = vec![\n" -" Shape::from(poly),\n" -" Shape::from(Circle::new(Point::new(10, 20), 5)),\n" -" ];\n" -" let perimeters = shapes\n" -" .iter()\n" -" .map(Shape::perimeter)\n" -" .map(round_two_digits)\n" -" .collect::>();\n" -" assert_eq!(perimeters, vec![15.48, 31.42]);\n" -" }\n" -"}\n" -"// ANCHOR_END: unit-tests\n" -"\n" -"fn main() {}\n" -"```" -msgstr "" - #: src/exercises/day-2/solutions-afternoon.md:1 #, fuzzy msgid "Day 2 Afternoon Exercises" @@ -22304,109 +22448,10 @@ msgstr "Exercices de l'après-midi du jour 2" #: src/exercises/day-2/solutions-afternoon.md:5 #, fuzzy -msgid "([back to exercise](luhn.md))" -msgstr "([retour à l'exercice](luhn.md))" - -#: src/exercises/day-2/solutions-afternoon.md:7 -msgid "" -"```rust\n" -"// Copyright 2022 Google LLC\n" -"//\n" -"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" -"// you may not use this file except in compliance with the License.\n" -"// You may obtain a copy of the License at\n" -"//\n" -"// http://www.apache.org/licenses/LICENSE-2.0\n" -"//\n" -"// Unless required by applicable law or agreed to in writing, software\n" -"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" -"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" -"// See the License for the specific language governing permissions and\n" -"// limitations under the License.\n" -"\n" -"// ANCHOR: luhn\n" -"pub fn luhn(cc_number: &str) -> bool {\n" -" // ANCHOR_END: luhn\n" -" let mut digits_seen = 0;\n" -" let mut sum = 0;\n" -" for (i, ch) in cc_number.chars().rev().filter(|&ch| ch != ' ')." -"enumerate() {\n" -" match ch.to_digit(10) {\n" -" Some(d) => {\n" -" sum += if i % 2 == 1 {\n" -" let dd = d * 2;\n" -" dd / 10 + dd % 10\n" -" } else {\n" -" d\n" -" };\n" -" digits_seen += 1;\n" -" }\n" -" None => return false,\n" -" }\n" -" }\n" -"\n" -" if digits_seen < 2 {\n" -" return false;\n" -" }\n" -"\n" -" sum % 10 == 0\n" -"}\n" -"\n" -"fn main() {\n" -" let cc_number = \"1234 5678 1234 5670\";\n" -" println!(\n" -" \"Is {cc_number} a valid credit card number? {}\",\n" -" if luhn(cc_number) { \"yes\" } else { \"no\" }\n" -" );\n" -"}\n" -"\n" -"// ANCHOR: unit-tests\n" -"#[test]\n" -"fn test_non_digit_cc_number() {\n" -" assert!(!luhn(\"foo\"));\n" -"}\n" -"\n" -"#[test]\n" -"fn test_empty_cc_number() {\n" -" assert!(!luhn(\"\"));\n" -" assert!(!luhn(\" \"));\n" -" assert!(!luhn(\" \"));\n" -" assert!(!luhn(\" \"));\n" -"}\n" -"\n" -"#[test]\n" -"fn test_single_digit_cc_number() {\n" -" assert!(!luhn(\"0\"));\n" -"}\n" -"\n" -"#[test]\n" -"fn test_two_digit_cc_number() {\n" -" assert!(luhn(\" 0 0 \"));\n" -"}\n" -"\n" -"#[test]\n" -"fn test_valid_cc_number() {\n" -" assert!(luhn(\"4263 9826 4026 9299\"));\n" -" assert!(luhn(\"4539 3195 0343 6467\"));\n" -" assert!(luhn(\"7992 7398 713\"));\n" -"}\n" -"\n" -"#[test]\n" -"fn test_invalid_cc_number() {\n" -" assert!(!luhn(\"4223 9826 4026 9299\"));\n" -" assert!(!luhn(\"4539 3195 0343 6476\"));\n" -" assert!(!luhn(\"8273 1232 7352 0569\"));\n" -"}\n" -"// ANCHOR_END: unit-tests\n" -"```" -msgstr "" - -#: src/exercises/day-2/solutions-afternoon.md:99 -#, fuzzy msgid "([back to exercise](strings-iterators.md))" msgstr "([retour à l'exercice](strings-iterators.md))" -#: src/exercises/day-2/solutions-afternoon.md:101 +#: src/exercises/day-2/solutions-afternoon.md:7 msgid "" "```rust\n" "// Copyright 2022 Google LLC\n" @@ -22677,6 +22722,254 @@ msgid "" "```" msgstr "" +#: src/exercises/day-3/solutions-morning.md:177 +#, fuzzy +msgid "([back to exercise](points-polygons.md))" +msgstr "([retour à l'exercice](points-polygones.md))" + +#: src/exercises/day-3/solutions-morning.md:179 +msgid "" +"```rust\n" +"// Copyright 2022 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"#[derive(Debug, Copy, Clone, PartialEq, Eq)]\n" +"// ANCHOR: Point\n" +"pub struct Point {\n" +" // ANCHOR_END: Point\n" +" x: i32,\n" +" y: i32,\n" +"}\n" +"\n" +"// ANCHOR: Point-impl\n" +"impl Point {\n" +" // ANCHOR_END: Point-impl\n" +" pub fn new(x: i32, y: i32) -> Point {\n" +" Point { x, y }\n" +" }\n" +"\n" +" pub fn magnitude(self) -> f64 {\n" +" f64::from(self.x.pow(2) + self.y.pow(2)).sqrt()\n" +" }\n" +"\n" +" pub fn dist(self, other: Point) -> f64 {\n" +" (self - other).magnitude()\n" +" }\n" +"}\n" +"\n" +"impl std::ops::Add for Point {\n" +" type Output = Self;\n" +"\n" +" fn add(self, other: Self) -> Self::Output {\n" +" Self {\n" +" x: self.x + other.x,\n" +" y: self.y + other.y,\n" +" }\n" +" }\n" +"}\n" +"\n" +"impl std::ops::Sub for Point {\n" +" type Output = Self;\n" +"\n" +" fn sub(self, other: Self) -> Self::Output {\n" +" Self {\n" +" x: self.x - other.x,\n" +" y: self.y - other.y,\n" +" }\n" +" }\n" +"}\n" +"\n" +"// ANCHOR: Polygon\n" +"pub struct Polygon {\n" +" // ANCHOR_END: Polygon\n" +" points: Vec,\n" +"}\n" +"\n" +"// ANCHOR: Polygon-impl\n" +"impl Polygon {\n" +" // ANCHOR_END: Polygon-impl\n" +" pub fn new() -> Polygon {\n" +" Polygon { points: Vec::new() }\n" +" }\n" +"\n" +" pub fn add_point(&mut self, point: Point) {\n" +" self.points.push(point);\n" +" }\n" +"\n" +" pub fn left_most_point(&self) -> Option {\n" +" self.points.iter().min_by_key(|p| p.x).copied()\n" +" }\n" +"\n" +" pub fn iter(&self) -> impl Iterator {\n" +" self.points.iter()\n" +" }\n" +"\n" +" pub fn length(&self) -> f64 {\n" +" if self.points.is_empty() {\n" +" return 0.0;\n" +" }\n" +"\n" +" let mut result = 0.0;\n" +" let mut last_point = self.points[0];\n" +" for point in &self.points[1..] {\n" +" result += last_point.dist(*point);\n" +" last_point = *point;\n" +" }\n" +" result += last_point.dist(self.points[0]);\n" +" result\n" +" // Alternatively, Iterator::zip() lets us iterate over the points as " +"pairs\n" +" // but we need to pair each point with the next one, and the last " +"point\n" +" // with the first point. The zip() iterator is finished as soon as " +"one of \n" +" // the source iterators is finished, a neat trick is to combine " +"Iterator::cycle\n" +" // with Iterator::skip to create the second iterator for the zip and " +"using map \n" +" // and sum to calculate the total length.\n" +" }\n" +"}\n" +"\n" +"// ANCHOR: Circle\n" +"pub struct Circle {\n" +" // ANCHOR_END: Circle\n" +" center: Point,\n" +" radius: i32,\n" +"}\n" +"\n" +"// ANCHOR: Circle-impl\n" +"impl Circle {\n" +" // ANCHOR_END: Circle-impl\n" +" pub fn new(center: Point, radius: i32) -> Circle {\n" +" Circle { center, radius }\n" +" }\n" +"\n" +" pub fn circumference(&self) -> f64 {\n" +" 2.0 * std::f64::consts::PI * f64::from(self.radius)\n" +" }\n" +"\n" +" pub fn dist(&self, other: &Self) -> f64 {\n" +" self.center.dist(other.center)\n" +" }\n" +"}\n" +"\n" +"// ANCHOR: Shape\n" +"pub enum Shape {\n" +" Polygon(Polygon),\n" +" Circle(Circle),\n" +"}\n" +"// ANCHOR_END: Shape\n" +"\n" +"impl From for Shape {\n" +" fn from(poly: Polygon) -> Self {\n" +" Shape::Polygon(poly)\n" +" }\n" +"}\n" +"\n" +"impl From for Shape {\n" +" fn from(circle: Circle) -> Self {\n" +" Shape::Circle(circle)\n" +" }\n" +"}\n" +"\n" +"impl Shape {\n" +" pub fn perimeter(&self) -> f64 {\n" +" match self {\n" +" Shape::Polygon(poly) => poly.length(),\n" +" Shape::Circle(circle) => circle.circumference(),\n" +" }\n" +" }\n" +"}\n" +"\n" +"// ANCHOR: unit-tests\n" +"#[cfg(test)]\n" +"mod tests {\n" +" use super::*;\n" +"\n" +" fn round_two_digits(x: f64) -> f64 {\n" +" (x * 100.0).round() / 100.0\n" +" }\n" +"\n" +" #[test]\n" +" fn test_point_magnitude() {\n" +" let p1 = Point::new(12, 13);\n" +" assert_eq!(round_two_digits(p1.magnitude()), 17.69);\n" +" }\n" +"\n" +" #[test]\n" +" fn test_point_dist() {\n" +" let p1 = Point::new(10, 10);\n" +" let p2 = Point::new(14, 13);\n" +" assert_eq!(round_two_digits(p1.dist(p2)), 5.00);\n" +" }\n" +"\n" +" #[test]\n" +" fn test_point_add() {\n" +" let p1 = Point::new(16, 16);\n" +" let p2 = p1 + Point::new(-4, 3);\n" +" assert_eq!(p2, Point::new(12, 19));\n" +" }\n" +"\n" +" #[test]\n" +" fn test_polygon_left_most_point() {\n" +" let p1 = Point::new(12, 13);\n" +" let p2 = Point::new(16, 16);\n" +"\n" +" let mut poly = Polygon::new();\n" +" poly.add_point(p1);\n" +" poly.add_point(p2);\n" +" assert_eq!(poly.left_most_point(), Some(p1));\n" +" }\n" +"\n" +" #[test]\n" +" fn test_polygon_iter() {\n" +" let p1 = Point::new(12, 13);\n" +" let p2 = Point::new(16, 16);\n" +"\n" +" let mut poly = Polygon::new();\n" +" poly.add_point(p1);\n" +" poly.add_point(p2);\n" +"\n" +" let points = poly.iter().cloned().collect::>();\n" +" assert_eq!(points, vec![Point::new(12, 13), Point::new(16, 16)]);\n" +" }\n" +"\n" +" #[test]\n" +" fn test_shape_perimeters() {\n" +" let mut poly = Polygon::new();\n" +" poly.add_point(Point::new(12, 13));\n" +" poly.add_point(Point::new(17, 11));\n" +" poly.add_point(Point::new(16, 16));\n" +" let shapes = vec![\n" +" Shape::from(poly),\n" +" Shape::from(Circle::new(Point::new(10, 20), 5)),\n" +" ];\n" +" let perimeters = shapes\n" +" .iter()\n" +" .map(Shape::perimeter)\n" +" .map(round_two_digits)\n" +" .collect::>();\n" +" assert_eq!(perimeters, vec![15.48, 31.42]);\n" +" }\n" +"}\n" +"// ANCHOR_END: unit-tests\n" +"\n" +"fn main() {}\n" +"```" +msgstr "" + #: src/exercises/day-3/solutions-afternoon.md:1 #, fuzzy msgid "Day 3 Afternoon Exercises" @@ -23315,8 +23608,8 @@ msgid "" "\n" " /// Returns whether there is currently an interrupt pending.\n" " ///\n" -" /// This should be true iff `matched` returns true and the interrupt is\n" -" /// masked.\n" +" /// This should be true if and only if `matched` returns true and the\n" +" /// interrupt is masked.\n" " pub fn interrupt_pending(&self) -> bool {\n" " // Safe because we know that self.registers points to the control\n" " // registers of a PL031 device which is appropriately mapped.\n" @@ -23429,8 +23722,8 @@ msgid "" "\n" " for i in 0..forks.len() {\n" " let tx = tx.clone();\n" -" let mut left_fork = forks[i].clone();\n" -" let mut right_fork = forks[(i + 1) % forks.len()].clone();\n" +" let mut left_fork = Arc::clone(&forks[i]);\n" +" let mut right_fork = Arc::clone(&forks[(i + 1) % forks.len()]);\n" "\n" " // To avoid a deadlock, we have to break the symmetry\n" " // somewhere. This will swap the forks without deinitializing\n" @@ -23462,6 +23755,211 @@ msgid "" "```" msgstr "" +#: src/exercises/concurrency/solutions-morning.md:104 +#, fuzzy +msgid "Link Checker" +msgstr "Vérificateur de liens à plusieurs threads" + +#: src/exercises/concurrency/solutions-morning.md:106 +#, fuzzy +msgid "([back to exercise](link-checker.md))" +msgstr "([retour à l'exercice](luhn.md))" + +#: src/exercises/concurrency/solutions-morning.md:108 +msgid "" +"```rust,compile_fail\n" +"// Copyright 2022 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"use std::{sync::Arc, sync::Mutex, sync::mpsc, thread};\n" +"\n" +"// ANCHOR: setup\n" +"use reqwest::{blocking::Client, Url};\n" +"use scraper::{Html, Selector};\n" +"use thiserror::Error;\n" +"\n" +"#[derive(Error, Debug)]\n" +"enum Error {\n" +" #[error(\"request error: {0}\")]\n" +" ReqwestError(#[from] reqwest::Error),\n" +" #[error(\"bad http response: {0}\")]\n" +" BadResponse(String),\n" +"}\n" +"// ANCHOR_END: setup\n" +"\n" +"// ANCHOR: visit_page\n" +"#[derive(Debug)]\n" +"struct CrawlCommand {\n" +" url: Url,\n" +" extract_links: bool,\n" +"}\n" +"\n" +"fn visit_page(client: &Client, command: &CrawlCommand) -> Result, " +"Error> {\n" +" println!(\"Checking {:#}\", command.url);\n" +" let response = client.get(command.url.clone()).send()?;\n" +" if !response.status().is_success() {\n" +" return Err(Error::BadResponse(response.status().to_string()));\n" +" }\n" +"\n" +" let mut link_urls = Vec::new();\n" +" if !command.extract_links {\n" +" return Ok(link_urls);\n" +" }\n" +"\n" +" let base_url = response.url().to_owned();\n" +" let body_text = response.text()?;\n" +" let document = Html::parse_document(&body_text);\n" +"\n" +" let selector = Selector::parse(\"a\").unwrap();\n" +" let href_values = document\n" +" .select(&selector)\n" +" .filter_map(|element| element.value().attr(\"href\"));\n" +" for href in href_values {\n" +" match base_url.join(href) {\n" +" Ok(link_url) => {\n" +" link_urls.push(link_url);\n" +" }\n" +" Err(err) => {\n" +" println!(\"On {base_url:#}: ignored unparsable {href:?}: " +"{err}\");\n" +" }\n" +" }\n" +" }\n" +" Ok(link_urls)\n" +"}\n" +"// ANCHOR_END: visit_page\n" +"\n" +"struct CrawlState {\n" +" domain: String,\n" +" visited_pages: std::collections::HashSet,\n" +"}\n" +"\n" +"impl CrawlState {\n" +" fn new(start_url: &Url) -> CrawlState {\n" +" let mut visited_pages = std::collections::HashSet::new();\n" +" visited_pages.insert(start_url.as_str().to_string());\n" +" CrawlState {\n" +" domain: start_url.domain().unwrap().to_string(),\n" +" visited_pages,\n" +" }\n" +" }\n" +"\n" +" /// Determine whether links within the given page should be extracted.\n" +" fn should_extract_links(&self, url: &Url) -> bool {\n" +" let Some(url_domain) = url.domain() else {\n" +" return false;\n" +" };\n" +" url_domain == self.domain\n" +" }\n" +"\n" +" /// Mark the given page as visited, returning true if it had already\n" +" /// been visited.\n" +" fn mark_visited(&mut self, url: &Url) -> bool {\n" +" self.visited_pages.insert(url.as_str().to_string())\n" +" }\n" +"}\n" +"\n" +"type CrawlResult = Result, (Url, Error)>;\n" +"fn spawn_crawler_threads(\n" +" command_receiver: mpsc::Receiver,\n" +" result_sender: mpsc::Sender,\n" +" thread_count: u32,\n" +") {\n" +" let command_receiver = Arc::new(Mutex::new(command_receiver));\n" +"\n" +" for _ in 0..thread_count {\n" +" let result_sender = result_sender.clone();\n" +" let command_receiver = command_receiver.clone();\n" +" thread::spawn(move || {\n" +" let client = Client::new();\n" +" loop {\n" +" let command_result = {\n" +" let receiver_guard = command_receiver.lock().unwrap();\n" +" receiver_guard.recv()\n" +" };\n" +" let Ok(crawl_command) = command_result else {\n" +" // The sender got dropped. No more commands coming in.\n" +" break;\n" +" };\n" +" let crawl_result = match visit_page(&client, &crawl_command) " +"{\n" +" Ok(link_urls) => Ok(link_urls),\n" +" Err(error) => Err((crawl_command.url, error)),\n" +" };\n" +" result_sender.send(crawl_result).unwrap();\n" +" }\n" +" });\n" +" }\n" +"}\n" +"\n" +"fn control_crawl(\n" +" start_url: Url,\n" +" command_sender: mpsc::Sender,\n" +" result_receiver: mpsc::Receiver,\n" +") -> Vec {\n" +" let mut crawl_state = CrawlState::new(&start_url);\n" +" let start_command = CrawlCommand { url: start_url, extract_links: " +"true };\n" +" command_sender.send(start_command).unwrap();\n" +" let mut pending_urls = 1;\n" +"\n" +" let mut bad_urls = Vec::new();\n" +" while pending_urls > 0 {\n" +" let crawl_result = result_receiver.recv().unwrap();\n" +" pending_urls -= 1;\n" +"\n" +" match crawl_result {\n" +" Ok(link_urls) => {\n" +" for url in link_urls {\n" +" if crawl_state.mark_visited(&url) {\n" +" let extract_links = crawl_state." +"should_extract_links(&url);\n" +" let crawl_command = CrawlCommand { url, " +"extract_links };\n" +" command_sender.send(crawl_command).unwrap();\n" +" pending_urls += 1;\n" +" }\n" +" }\n" +" }\n" +" Err((url, error)) => {\n" +" bad_urls.push(url);\n" +" println!(\"Got crawling error: {:#}\", error);\n" +" continue;\n" +" }\n" +" }\n" +" }\n" +" bad_urls\n" +"}\n" +"\n" +"fn check_links(start_url: Url) -> Vec {\n" +" let (result_sender, result_receiver) = mpsc::channel::();\n" +" let (command_sender, command_receiver) = mpsc::channel::" +"();\n" +" spawn_crawler_threads(command_receiver, result_sender, 16);\n" +" control_crawl(start_url, command_sender, result_receiver)\n" +"}\n" +"\n" +"fn main() {\n" +" let start_url = reqwest::Url::parse(\"https://www.google.org\")." +"unwrap();\n" +" let bad_urls = check_links(start_url);\n" +" println!(\"Bad URLs: {:#?}\", bad_urls);\n" +"}\n" +"```" +msgstr "" + #: src/exercises/concurrency/solutions-afternoon.md:1 #, fuzzy msgid "Concurrency Afternoon Exercise" @@ -23552,14 +24050,19 @@ msgid "" " let mut philosophers = vec![];\n" " let (tx, rx) = mpsc::channel(10);\n" " for (i, name) in PHILOSOPHERS.iter().enumerate() {\n" -" let left_fork = forks[i].clone();\n" -" let right_fork = forks[(i + 1) % PHILOSOPHERS.len()].clone();\n" +" let left_fork = Arc::clone(&forks[i]);\n" +" let right_fork = Arc::clone(&forks[(i + 1) % PHILOSOPHERS." +"len()]);\n" +" // To avoid a deadlock, we have to break the symmetry\n" +" // somewhere. This will swap the forks without deinitializing\n" +" // either of them.\n" +" if i == 0 {\n" +" std::mem::swap(&mut left_fork, &mut right_fork);\n" +" }\n" " philosophers.push(Philosopher {\n" " name: name.to_string(),\n" -" left_fork: if i % 2 == 0 { left_fork.clone() } else " -"{ right_fork.clone() },\n" -" right_fork: if i % 2 == 0 { right_fork } else " -"{ left_fork },\n" +" left_fork,\n" +" right_fork,\n" " thoughts: tx.clone(),\n" " });\n" " }\n" @@ -23586,12 +24089,12 @@ msgid "" "```" msgstr "" -#: src/exercises/concurrency/solutions-afternoon.md:115 +#: src/exercises/concurrency/solutions-afternoon.md:121 #, fuzzy msgid "([back to exercise](chat-app.md))" msgstr "([retour à l'exercice](rtc.md))" -#: src/exercises/concurrency/solutions-afternoon.md:119 +#: src/exercises/concurrency/solutions-afternoon.md:125 msgid "" "```rust,compile_fail\n" "// Copyright 2023 Google LLC\n" @@ -23678,7 +24181,7 @@ msgid "" "```" msgstr "" -#: src/exercises/concurrency/solutions-afternoon.md:204 +#: src/exercises/concurrency/solutions-afternoon.md:210 msgid "" "```rust,compile_fail\n" "// Copyright 2023 Google LLC\n" @@ -23737,3 +24240,294 @@ msgid "" "}\n" "```" msgstr "" + +#~ msgid "Comparison" +#~ msgstr "Comparaison" + +#~ msgid "" +#~ "[![Build workflow](https://img.shields.io/github/actions/workflow/status/" +#~ "google/comprehensive-rust/build.yml?style=flat-square)](https://github." +#~ "com/google/comprehensive-rust/actions/workflows/build.yml?" +#~ "query=branch%3Amain)" +#~ msgstr "" +#~ "[![Flux de construction](https://img.shields.io/github/actions/workflow/" +#~ "status/google/comprehensive-rust/build.yml?style=flat-square)](https://" +#~ "github.com/google/comprehensive-rust/actions/workflows/build.yml?" +#~ "query=branch%3Amain)" + +#~ msgid "Build workflow" +#~ msgstr "Flux de construction" + +#~ msgid "GitHub contributors" +#~ msgstr "Contributeurs GitHub" + +#~ msgid "" +#~ "[![GitHub contributors](https://img.shields.io/github/contributors/google/" +#~ "comprehensive-rust?style=flat-square)](https://github.com/google/" +#~ "comprehensive-rust/graphs/contributors) [![GitHub stars](https://img." +#~ "shields.io/github/stars/google/comprehensive-rust?style=flat-square)]" +#~ "(https://github.com/google/comprehensive-rust/stargazers)" +#~ msgstr "" +#~ "[![Contributeurs GitHub](https://img.shields.io/github/contributors/" +#~ "google/comprehensive-rust?style=flat-square)](https://github.com/google/" +#~ "comprehensive-rust/graphs/contributors) [![GitHub étoiles](https://img." +#~ "shields.io/github/stars/google/comprehensive-rust?style=flat-square)]" +#~ "(https://github.com/google/comprehensive-rust/stargazers)" + +#~ msgid "GitHub stars" +#~ msgstr "Étoiles GitHub" + +#~ msgid "" +#~ "[![GitHub stars](https://img.shields.io/github/stars/google/comprehensive-" +#~ "rust?style=flat-square)](https://github.com/google/comprehensive-rust/" +#~ "stargazers)" +#~ msgstr "" +#~ "[![GitHub étoiles](https://img.shields.io/github/stars/google/" +#~ "comprehensive-rust?style=flat-square)](https://github.com/google/" +#~ "comprehensive-rust/stargazers)" + +#~ msgid "The course is fast paced and covers a lot of ground:" +#~ msgstr "Le cours est rapide et couvre beaucoup de terrain:" + +#, fuzzy +#~ msgid "Day 1: Basic Rust, ownership and the borrow checker." +#~ msgstr "Jour 1 : Rust de base, propriété et vérificateur d'emprunt." + +#, fuzzy +#~ msgid "Concurrency" +#~ msgstr "Concurrence" + +#~ msgid "Rustup (Recommended)" +#~ msgstr "Rustup (recommandé)" + +#~ msgid "" +#~ "You can follow the instructions to install cargo and rust compiler, among " +#~ "other standard ecosystem tools with the [rustup](https://rust-analyzer." +#~ "github.io/) tool, which is maintained by the Rust Foundation." +#~ msgstr "" +#~ "Vous pouvez suivre les instructions pour installer Cargo et le " +#~ "compilateur Rust, parmi d'autres outils de l'écosystème standard avec " +#~ "l'outil [rustup](https://rust-analyzer.github.io/), qui est maintenu par " +#~ "la Foundation Rust." + +#~ msgid "Package Managers" +#~ msgstr "\\### Gestionnaires de packages" + +#~ msgid "Debian" +#~ msgstr "Debian" + +#, fuzzy +#~ msgid "" +#~ "After looking at the exercises, you can look at the \\[solutions\\] " +#~ "provided." +#~ msgstr "" +#~ "Après avoir regardé les exercices, vous pouvez regarder les " +#~ "\\[solutions\\] fournies." + +#, fuzzy +#~ msgid "" +#~ "Note that since `println!` is a macro, `x` is not moved, even using the " +#~ "function like syntax of `println!(\"x: {}\", x)`" +#~ msgstr "" +#~ "Notez que puisque `println!` est une macro, `x` n'est pas déplacé, même " +#~ "en utilisant la fonction comme syntaxe de `println!(\"x: {}\", x)`" + +#, fuzzy +#~ msgid "Global state is managed with static and constant variables." +#~ msgstr "L'état global est géré avec des variables statiques et constantes." + +#, fuzzy +#~ msgid "You can declare compile-time constants:" +#~ msgstr "Vous pouvez déclarer des constantes de compilation :" + +#, fuzzy +#~ msgid "You can also declare static variables:" +#~ msgstr "Vous pouvez également déclarer des variables statiques :" + +#, fuzzy +#~ msgid "" +#~ "We will look at mutating static data in the [chapter on Unsafe Rust](../" +#~ "unsafe.md)." +#~ msgstr "" +#~ "Nous examinerons la mutation des données statiques dans le [chapitre sur " +#~ "Unsafe Rust](../unsafe.md)." + +#, fuzzy +#~ msgid "" +#~ "Depending on which abstraction (or combination of abstractions) you " +#~ "choose, can be a single unique pointer, reference counted, or atomically " +#~ "reference counted." +#~ msgstr "" +#~ "Selon l'abstraction (ou la combinaison d'abstractions) que vous " +#~ "choisissez, il peut s'agir d'un seul pointeur unique, d'une référence " +#~ "comptée ou d'une référence atomique comptée." + +#, fuzzy +#~ msgid "Here is a rough comparison of the memory management techniques." +#~ msgstr "" +#~ "Voici une comparaison approximative des techniques de gestion de la " +#~ "mémoire." + +#, fuzzy +#~ msgid "Pros of Different Memory Management Techniques" +#~ msgstr "Avantages des différentes techniques de gestion de la mémoire" + +#, fuzzy +#~ msgid "Manual like C:" +#~ msgstr "Manuel comme C :" + +#, fuzzy +#~ msgid "No runtime overhead." +#~ msgstr "Aucune surcharge d'exécution." + +#, fuzzy +#~ msgid "Automatic like Java:" +#~ msgstr "Automatique comme Java :" + +#, fuzzy +#~ msgid "Fully automatic." +#~ msgstr "Entièrement automatique." + +#, fuzzy +#~ msgid "Safe and correct." +#~ msgstr "Sûr et correct." + +#, fuzzy +#~ msgid "Scope-based like C++:" +#~ msgstr "Basé sur la portée comme C++ :" + +#, fuzzy +#~ msgid "Partially automatic." +#~ msgstr "Partiellement automatique." + +#, fuzzy +#~ msgid "Compiler-enforced scope-based like Rust:" +#~ msgstr "Basé sur la portée imposée par le compilateur comme Rust :" + +#, fuzzy +#~ msgid "Enforced by compiler." +#~ msgstr "Appliqué par le compilateur." + +#, fuzzy +#~ msgid "Cons of Different Memory Management Techniques" +#~ msgstr "Inconvénients des différentes techniques de gestion de la mémoire" + +#, fuzzy +#~ msgid "Use-after-free." +#~ msgstr "Utiliser-après-libre." + +#, fuzzy +#~ msgid "Double-frees." +#~ msgstr "Double-gratuit." + +#, fuzzy +#~ msgid "Memory leaks." +#~ msgstr "Fuites de mémoire." + +#, fuzzy +#~ msgid "Garbage collection pauses." +#~ msgstr "La collecte des ordures s'arrête." + +#, fuzzy +#~ msgid "Destructor delays." +#~ msgstr "Retards de destructeur." + +#, fuzzy +#~ msgid "Complex, opt-in by programmer." +#~ msgstr "Complexe, opt-in par le programmeur." + +#, fuzzy +#~ msgid "Potential for use-after-free." +#~ msgstr "Potentiel d'utilisation-après-libre." + +#, fuzzy +#~ msgid "Compiler-enforced and scope-based like Rust:" +#~ msgstr "Renforcé par le compilateur et basé sur la portée comme Rust :" + +#, fuzzy +#~ msgid "Some upfront complexity." +#~ msgstr "Une certaine complexité initiale." + +#, fuzzy +#~ msgid "Can reject valid programs." +#~ msgstr "Peut rejeter les programmes valides." + +#, fuzzy +#~ msgid "The data was _moved_ from `s1` and `s1` is no longer accessible." +#~ msgstr "" +#~ "Les données ont été _déplacées_ de `s1` et `s1` n'est plus accessible." + +#, fuzzy +#~ msgid "A small book library," +#~ msgstr "Une petite bibliothèque de livres," + +#, fuzzy +#~ msgid "Iterators and ownership (hard)." +#~ msgstr "Itérateurs et propriété (difficile)." + +#, fuzzy +#~ msgid "Simple struct which tracks health statistics." +#~ msgstr "Structure simple qui suit les statistiques de santé." + +#, fuzzy +#~ msgid "Multiple structs and enums for a drawing library." +#~ msgstr "" +#~ "Plusieurs structures et énumérations pour une bibliothèque de dessins." + +#, fuzzy +#~ msgid "" +#~ "If you need to mutate the data inside an `Rc`, you will need to wrap the " +#~ "data in a type such as [`Cell` or `RefCell`](../concurrency/shared_state/" +#~ "arc.md)." +#~ msgstr "" +#~ "Si vous avez besoin de muter les données à l'intérieur d'un `Rc`, vous " +#~ "devrez envelopper les données dans un type tel que [`Cell` ou `RefCell`]" +#~ "(../concurrency/shared_state/arc.md)." + +#, fuzzy +#~ msgid "" +#~ "Compare the different datatypes mentioned. `Box` enables (im)mutable " +#~ "borrows that are enforced at compile time. `RefCell` enables (im)mutable " +#~ "borrows that are enforced at run time and will panic if it fails at " +#~ "runtime." +#~ msgstr "" +#~ "Comparez les différents types de données mentionnés. `Box` active les " +#~ "emprunts (im)mutables qui sont appliqués au moment de la compilation. " +#~ "`RefCell` active les emprunts (im)mutables qui sont appliqués au moment " +#~ "de l'exécution et paniqueront s'ils échouent au moment de l'exécution." + +#, fuzzy +#~ msgid "The module content can be omitted:" +#~ msgstr "Le contenu du module peut être omis :" + +#, fuzzy +#~ msgid "The `garden` module content is found at:" +#~ msgstr "Le contenu du module \"jardin\" se trouve à :" + +#, fuzzy +#~ msgid "`src/garden.rs` (modern Rust 2018 style)" +#~ msgstr "`src/garden.rs` (style Rust 2018 moderne)" + +#, fuzzy +#~ msgid "`src/garden/mod.rs` (older Rust 2015 style)" +#~ msgstr "`src/garden/mod.rs` (ancien style Rust 2015)" + +#, fuzzy +#~ msgid "Similarly, a `garden::vegetables` module can be found at:" +#~ msgstr "De même, un module `garden::legumes` peut être trouvé à :" + +#, fuzzy +#~ msgid "`src/garden/vegetables.rs` (modern Rust 2018 style)" +#~ msgstr "`src/garden/vegetables.rs` (style Rust 2018 moderne)" + +#, fuzzy +#~ msgid "`src/garden/vegetables/mod.rs` (older Rust 2015 style)" +#~ msgstr "`src/garden/vegetables/mod.rs` (ancien style Rust 2015)" + +#, fuzzy +#~ msgid "" +#~ "Copy the following code to and implement " +#~ "the function:" +#~ msgstr "" +#~ "Copiez le code suivant sur et implémentez " +#~ "le fonction:"