diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 825f7a25..1bea898d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -13,7 +13,7 @@ po/ko.po @jiyongp @jooyunghan po/pl.po @jkotur @dyeroshenko po/pt-BR.po @rastringer @hugojacob @henrif75 @joaovicmendes po/ru.po @istolga @baltuky @zvonden @dyeroshenko -po/tr.po @duyguisler +po/tr.po @duyguisler @enes1313 po/uk.po @dyeroshenko po/zh-CN.po @suetfei @wnghl @anlunx @kongy @noahdragon @superwhd @emmali01 @SketchK po/zh-TW.po @edong @hueich @kuanhungchen @victorhsieh @mingyc @johnathan79717 diff --git a/po/tr.po b/po/tr.po index 94deb48e..8236ef60 100644 --- a/po/tr.po +++ b/po/tr.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: Comprehensive Rust 🦀\n" -"POT-Creation-Date: 2023-08-26\n" -"PO-Revision-Date: 2023-08-25 14:48-0700\n" +"POT-Creation-Date: 2023-10-24T20:37:45+03:00\n" +"PO-Revision-Date: 2023-10-27 14:20+0300\n" "Last-Translator: akerem@protonmail.com\n" "Language-Team: Turkish \n" "Language: tr\n" @@ -10,7 +10,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 3.3.2\n" +"X-Generator: Poedit 3.4.1\n" #: src/SUMMARY.md:4 src/index.md:1 msgid "Welcome to Comprehensive Rust 🦀" @@ -18,7 +18,7 @@ msgstr "Comprehensive Rust'a Hoşgeldiniz 🦀" #: src/SUMMARY.md:5 src/running-the-course.md:1 msgid "Running the Course" -msgstr "TODO:" +msgstr "Kursun Çalıştırılması" #: src/SUMMARY.md:6 src/running-the-course/course-structure.md:1 msgid "Course Structure" @@ -34,7 +34,7 @@ msgstr "Çeviriler" #: src/SUMMARY.md:9 src/cargo.md:1 msgid "Using Cargo" -msgstr "Cargo'yu Kullanmak" +msgstr "Cargo Kullanımı" #: src/SUMMARY.md:10 msgid "Rust Ecosystem" @@ -46,14 +46,14 @@ msgstr "Kod Örnekleri" #: src/SUMMARY.md:12 msgid "Running Cargo Locally" -msgstr "Cargo'yu Bilgisayarınızda Çalıştırmak" +msgstr "Cargo'nun Yerel (Local) Olarak Çalıştırılması" #: src/SUMMARY.md:15 msgid "Day 1: Morning" msgstr "Gün 1: Sabah" -#: src/SUMMARY.md:19 src/SUMMARY.md:79 src/SUMMARY.md:137 src/SUMMARY.md:195 -#: src/SUMMARY.md:221 src/SUMMARY.md:271 +#: src/SUMMARY.md:19 src/SUMMARY.md:80 src/SUMMARY.md:135 src/SUMMARY.md:193 +#: src/SUMMARY.md:219 src/SUMMARY.md:269 msgid "Welcome" msgstr "Hoşgeldiniz" @@ -67,72 +67,76 @@ msgstr "Merhaba Dünya!" #: src/SUMMARY.md:22 src/hello-world/small-example.md:1 msgid "Small Example" -msgstr "Basit Örnek" +msgstr "Küçük Örnek" #: src/SUMMARY.md:23 src/why-rust.md:1 msgid "Why Rust?" msgstr "Neden Rust?" -#: src/SUMMARY.md:24 src/why-rust/compile-time.md:1 +#: src/SUMMARY.md:24 src/why-rust/an-example-in-c.md:1 src/credits.md:32 +msgid "An Example in C" +msgstr "C Dilinde Bir Örnek" + +#: src/SUMMARY.md:25 src/why-rust/compile-time.md:1 msgid "Compile Time Guarantees" msgstr "Derleme Zamanı Garantileri" -#: src/SUMMARY.md:25 src/why-rust/runtime.md:1 +#: src/SUMMARY.md:26 src/why-rust/runtime.md:1 msgid "Runtime Guarantees" msgstr "Çalışma Zamanı Garantileri" -#: src/SUMMARY.md:26 src/why-rust/modern.md:1 +#: src/SUMMARY.md:27 src/why-rust/modern.md:1 msgid "Modern Features" msgstr "Modern Özellikler" -#: src/SUMMARY.md:27 src/basic-syntax.md:1 +#: src/SUMMARY.md:28 src/basic-syntax.md:1 msgid "Basic Syntax" -msgstr "Sözdizimi" +msgstr "Temel Sözdizimi" -#: src/SUMMARY.md:28 src/basic-syntax/scalar-types.md:1 +#: src/SUMMARY.md:29 src/basic-syntax/scalar-types.md:1 msgid "Scalar Types" -msgstr "Skaler Tipler" +msgstr "Skaler Türler" -#: src/SUMMARY.md:29 src/basic-syntax/compound-types.md:1 +#: src/SUMMARY.md:30 src/basic-syntax/compound-types.md:1 msgid "Compound Types" -msgstr "Bileşik Tipler" +msgstr "Bileşik Türler" -#: src/SUMMARY.md:30 src/basic-syntax/references.md:1 +#: src/SUMMARY.md:31 src/basic-syntax/references.md:1 msgid "References" msgstr "Referanslar" -#: src/SUMMARY.md:31 src/basic-syntax/references-dangling.md:1 +#: src/SUMMARY.md:32 src/basic-syntax/references-dangling.md:1 msgid "Dangling References" -msgstr "Askılı Referanslar" +msgstr "Geçersiz (Dangling) Referanslar" -#: src/SUMMARY.md:32 src/basic-syntax/slices.md:1 +#: src/SUMMARY.md:33 src/basic-syntax/slices.md:1 msgid "Slices" -msgstr "Dilimler" +msgstr "Dilimler (Slices)" -#: src/SUMMARY.md:33 +#: src/SUMMARY.md:34 msgid "String vs str" msgstr "String vs str" -#: src/SUMMARY.md:34 src/basic-syntax/functions.md:1 +#: src/SUMMARY.md:35 src/basic-syntax/functions.md:1 msgid "Functions" msgstr "Fonksiyonlar" -#: src/SUMMARY.md:35 src/basic-syntax/rustdoc.md:1 +#: src/SUMMARY.md:36 src/basic-syntax/rustdoc.md:1 msgid "Rustdoc" msgstr "Rustdoc" -#: src/SUMMARY.md:36 src/SUMMARY.md:107 src/basic-syntax/methods.md:1 +#: src/SUMMARY.md:37 src/SUMMARY.md:103 src/basic-syntax/methods.md:1 #: src/methods.md:1 msgid "Methods" msgstr "Metotlar" -#: src/SUMMARY.md:37 +#: src/SUMMARY.md:38 msgid "Overloading" -msgstr "Aşırı Yükleme" +msgstr "Yükleme (Overloading)" -#: src/SUMMARY.md:38 src/SUMMARY.md:71 src/SUMMARY.md:100 src/SUMMARY.md:110 -#: src/SUMMARY.md:129 src/SUMMARY.md:157 src/SUMMARY.md:187 src/SUMMARY.md:214 -#: src/SUMMARY.md:235 src/SUMMARY.md:263 src/SUMMARY.md:285 src/SUMMARY.md:306 +#: src/SUMMARY.md:39 src/SUMMARY.md:72 src/SUMMARY.md:106 src/SUMMARY.md:126 +#: src/SUMMARY.md:155 src/SUMMARY.md:185 src/SUMMARY.md:212 src/SUMMARY.md:233 +#: src/SUMMARY.md:261 src/SUMMARY.md:283 src/SUMMARY.md:304 #: 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,164 +144,154 @@ msgstr "Aşırı Yükleme" msgid "Exercises" msgstr "Egzersizler" -#: src/SUMMARY.md:39 src/exercises/day-1/implicit-conversions.md:1 +#: src/SUMMARY.md:40 src/exercises/day-1/implicit-conversions.md:1 msgid "Implicit Conversions" msgstr "Örtülü Dönüşümler" -#: src/SUMMARY.md:40 +#: src/SUMMARY.md:41 msgid "Arrays and for Loops" msgstr "Diziler ve for Döngüleri" -#: src/SUMMARY.md:42 +#: src/SUMMARY.md:43 msgid "Day 1: Afternoon" -msgstr "Gün 2: Öğleden Sonra" +msgstr "Gün 1: Öğleden Sonra" -#: src/SUMMARY.md:44 src/SUMMARY.md:298 src/control-flow.md:1 +#: src/SUMMARY.md:45 src/SUMMARY.md:296 src/control-flow.md:1 msgid "Control Flow" msgstr "Kontrol Akışı" -#: src/SUMMARY.md:45 src/control-flow/blocks.md:1 +#: src/SUMMARY.md:46 src/control-flow/blocks.md:1 msgid "Blocks" msgstr "Bloklar" -#: src/SUMMARY.md:46 -msgid "if expressions" -msgstr "if İfadelesi" - #: src/SUMMARY.md:47 -msgid "for expressions" -msgstr "for İfadesi" +msgid "if expressions" +msgstr "if İfadeleri" #: src/SUMMARY.md:48 -msgid "while expressions" -msgstr "while İfadesi" +msgid "for expressions" +msgstr "for İfadeleri" #: src/SUMMARY.md:49 +msgid "while expressions" +msgstr "while İfadeleri" + +#: src/SUMMARY.md:50 msgid "break & continue" msgstr "break & continue" -#: src/SUMMARY.md:50 +#: src/SUMMARY.md:51 msgid "loop expressions" -msgstr "loop İfadesi" +msgstr "loop İfadeleri" -#: src/SUMMARY.md:52 src/basic-syntax/variables.md:1 +#: src/SUMMARY.md:53 src/basic-syntax/variables.md:1 msgid "Variables" msgstr "Değişkenler" -#: src/SUMMARY.md:53 src/basic-syntax/type-inference.md:1 +#: src/SUMMARY.md:54 src/basic-syntax/type-inference.md:1 msgid "Type Inference" msgstr "Tür Çıkarımı" -#: src/SUMMARY.md:54 +#: src/SUMMARY.md:55 msgid "static & const" msgstr "static & const" -#: src/SUMMARY.md:55 src/basic-syntax/scopes-shadowing.md:1 +#: src/SUMMARY.md:56 src/basic-syntax/scopes-shadowing.md:1 msgid "Scopes and Shadowing" -msgstr "Kapsamlar ve Gölgeleme" +msgstr "Kapsamlar (Scopes) ve Gölgeleme (Shadowing)" -#: src/SUMMARY.md:56 src/enums.md:1 +#: src/SUMMARY.md:57 src/enums.md:1 msgid "Enums" msgstr "Enumlar" -#: src/SUMMARY.md:57 src/enums/variant-payloads.md:1 +#: src/SUMMARY.md:58 src/enums/variant-payloads.md:1 msgid "Variant Payloads" -msgstr "Değişken Yükler" +msgstr "Varyant Yükler" -#: src/SUMMARY.md:58 src/enums/sizes.md:1 +#: src/SUMMARY.md:59 src/enums/sizes.md:1 msgid "Enum Sizes" -msgstr "Enum Büyüklükleri" +msgstr "Enum Boyutları" -#: src/SUMMARY.md:60 src/control-flow/novel.md:1 -#, fuzzy +#: src/SUMMARY.md:61 src/control-flow/novel.md:1 msgid "Novel Control Flow" -msgstr "Kontrol Akışı" - -#: src/SUMMARY.md:61 -msgid "if let expressions" -msgstr "if let İfadesi" +msgstr "Yeni Kontrol Akışları" #: src/SUMMARY.md:62 -msgid "while let expressions" -msgstr "while let İfadesi" +msgid "if let expressions" +msgstr "if let İfadeleri" #: src/SUMMARY.md:63 +msgid "while let expressions" +msgstr "while let İfadeleri" + +#: src/SUMMARY.md:64 msgid "match expressions" -msgstr "match İfadesi" +msgstr "match ifadeleri" -#: src/SUMMARY.md:65 src/pattern-matching.md:1 +#: src/SUMMARY.md:66 src/SUMMARY.md:74 src/pattern-matching.md:1 msgid "Pattern Matching" -msgstr "Şablon Eşleştirme" +msgstr "Desen Eşleştirme" -#: src/SUMMARY.md:66 src/pattern-matching/destructuring-enums.md:1 +#: src/SUMMARY.md:67 src/pattern-matching/destructuring-enums.md:1 msgid "Destructuring Enums" -msgstr "Enumları Yok Etme" +msgstr "Enumların Çözümlenmesi" -#: src/SUMMARY.md:67 src/pattern-matching/destructuring-structs.md:1 +#: src/SUMMARY.md:68 src/pattern-matching/destructuring-structs.md:1 msgid "Destructuring Structs" -msgstr "Veri Yapılarını Yok Etme" +msgstr "Yapıların (Struct) Çözümlenmesi" -#: src/SUMMARY.md:68 src/pattern-matching/destructuring-arrays.md:1 +#: src/SUMMARY.md:69 src/pattern-matching/destructuring-arrays.md:1 msgid "Destructuring Arrays" -msgstr "Dizileri Yok Etme" +msgstr "Dizilerin Çözümlenmesi" -#: src/SUMMARY.md:69 src/pattern-matching/match-guards.md:1 +#: src/SUMMARY.md:70 src/pattern-matching/match-guards.md:1 msgid "Match Guards" -msgstr "Eşleştirme Muhafızları" +msgstr "Eşleşme Koşulları/Filtreleri" -#: src/SUMMARY.md:72 src/exercises/day-1/luhn.md:1 +#: src/SUMMARY.md:73 src/exercises/day-1/luhn.md:1 #: src/exercises/day-1/solutions-afternoon.md:3 msgid "Luhn Algorithm" msgstr "Luhn Algrotiması" -#: src/SUMMARY.md:73 -#, fuzzy -msgid "Pattern Matching (TBD)" -msgstr "Şablon Eşleştirme" - -#: src/SUMMARY.md:75 +#: src/SUMMARY.md:76 msgid "Day 2: Morning" msgstr "Gün 2: Sabah" -#: src/SUMMARY.md:81 src/memory-management.md:1 +#: src/SUMMARY.md:82 src/memory-management.md:1 msgid "Memory Management" msgstr "Bellek Yönetimi" -#: src/SUMMARY.md:82 +#: src/SUMMARY.md:83 msgid "Stack vs Heap" msgstr "Stack vs Heap" -#: src/SUMMARY.md:83 +#: src/SUMMARY.md:84 msgid "Stack Memory" msgstr "Stack Belleği" -#: src/SUMMARY.md:84 src/memory-management/manual.md:1 +#: src/SUMMARY.md:85 src/memory-management/manual.md:1 msgid "Manual Memory Management" msgstr "Manuel Bellek Yönetimi" -#: src/SUMMARY.md:85 src/memory-management/scope-based.md:1 +#: src/SUMMARY.md:86 src/memory-management/scope-based.md:1 msgid "Scope-Based Memory Management" msgstr "Kapsam Tabanlı Bellek Yönetimi" -#: src/SUMMARY.md:86 +#: src/SUMMARY.md:87 msgid "Garbage Collection" msgstr "Çöp Toplama" -#: src/SUMMARY.md:87 +#: src/SUMMARY.md:88 msgid "Rust Memory Management" msgstr "Rust Bellek Yönetimi" -#: src/SUMMARY.md:88 src/memory-management/comparison.md:1 -msgid "Comparison" -msgstr "Karşılaştırma" - #: src/SUMMARY.md:89 src/ownership.md:1 msgid "Ownership" msgstr "Sahiplik" #: src/SUMMARY.md:90 src/ownership/move-semantics.md:1 msgid "Move Semantics" -msgstr "Taşıma Şematiği" +msgstr "Taşıma Semantiği" #: src/SUMMARY.md:91 src/ownership/moved-strings-rust.md:1 msgid "Moved Strings in Rust" @@ -305,7 +299,7 @@ msgstr "Rust'da Taşınmış Stringler" #: src/SUMMARY.md:92 msgid "Double Frees in Modern C++" -msgstr "Modern C++'da Çifte Serbestlik" +msgstr "Modern C++'da Double Free'ler (Adresi iki kez serbest bırakma)" #: src/SUMMARY.md:93 src/ownership/moves-function-calls.md:1 msgid "Moves in Function Calls" @@ -321,7 +315,7 @@ msgstr "Ödünç Alma" #: src/SUMMARY.md:96 src/ownership/shared-unique-borrows.md:1 msgid "Shared and Unique Borrows" -msgstr "Paylaşılan ve Eşsiz Ödünç Almalar" +msgstr "Paylaşımlı (Shared) ve Eşsiz (Unique) Ödünç Almalar" #: src/SUMMARY.md:97 src/ownership/lifetimes.md:1 msgid "Lifetimes" @@ -335,707 +329,708 @@ msgstr "Fonksiyon Çağrılarında Ömürler" msgid "Lifetimes in Data Structures" msgstr "Veri Yapılarında Ömürler" -#: src/SUMMARY.md:101 src/exercises/day-2/book-library.md:1 -#, fuzzy -msgid "Storing Books" -msgstr "String" - -#: src/SUMMARY.md:102 src/exercises/day-2/iterators-and-ownership.md:1 -msgid "Iterators and Ownership" -msgstr "Yineleyiciler ve Sahiplik" - -#: src/SUMMARY.md:104 src/structs.md:1 +#: src/SUMMARY.md:100 src/structs.md:1 msgid "Structs" -msgstr "Veri Yapıları" +msgstr "Yapılar (Structs)" -#: src/SUMMARY.md:105 src/structs/tuple-structs.md:1 +#: src/SUMMARY.md:101 src/structs/tuple-structs.md:1 msgid "Tuple Structs" -msgstr "Tuple Veri Yapısı" +msgstr "Tuple Yapıları (Tuple Structs)" -#: src/SUMMARY.md:106 src/structs/field-shorthand.md:1 +#: src/SUMMARY.md:102 src/structs/field-shorthand.md:1 msgid "Field Shorthand Syntax" -msgstr "TODO:" +msgstr "Alanlara İlk Değer Verme Kısaltması'nın Sözdizimi (Syntax)" -#: src/SUMMARY.md:108 src/methods/receiver.md:1 +#: src/SUMMARY.md:104 src/methods/receiver.md:1 msgid "Method Receiver" msgstr "Metot Alıcısı" -#: src/SUMMARY.md:109 src/SUMMARY.md:169 src/SUMMARY.md:284 +#: src/SUMMARY.md:105 src/SUMMARY.md:167 src/SUMMARY.md:282 #: src/methods/example.md:1 src/concurrency/shared_state/example.md:1 msgid "Example" msgstr "Örnek" -#: src/SUMMARY.md:111 src/exercises/day-2/health-statistics.md:1 +#: src/SUMMARY.md:107 src/exercises/day-2/book-library.md:1 +msgid "Storing Books" +msgstr "Kitapların Saklanması" + +#: src/SUMMARY.md:108 src/exercises/day-2/health-statistics.md:1 +#: src/exercises/day-2/solutions-morning.md:151 msgid "Health Statistics" msgstr "Sağlık İstatistikleri" -#: src/SUMMARY.md:113 +#: src/SUMMARY.md:110 msgid "Day 2: Afternoon" msgstr "Gün 2: Öğleden Sonra" -#: src/SUMMARY.md:115 src/std.md:1 +#: src/SUMMARY.md:112 src/std.md:1 msgid "Standard Library" msgstr "Standart Kütüphane" -#: src/SUMMARY.md:116 +#: src/SUMMARY.md:113 msgid "Option and Result" msgstr "Option ve Result" -#: src/SUMMARY.md:117 src/std/string.md:1 +#: src/SUMMARY.md:114 src/std/string.md:1 msgid "String" msgstr "String" -#: src/SUMMARY.md:118 +#: src/SUMMARY.md:115 msgid "Vec" msgstr "Vec" -#: src/SUMMARY.md:119 +#: src/SUMMARY.md:116 msgid "HashMap" msgstr "HashMap" -#: src/SUMMARY.md:120 +#: src/SUMMARY.md:117 msgid "Box" msgstr "Box" -#: src/SUMMARY.md:121 +#: src/SUMMARY.md:118 msgid "Recursive Data Types" msgstr "Özyinelemeli Veri Türleri" -#: src/SUMMARY.md:122 src/std/box-niche.md:1 +#: src/SUMMARY.md:119 src/std/box-niche.md:1 msgid "Niche Optimization" msgstr "Niche Optimizasyonu" -#: src/SUMMARY.md:123 +#: src/SUMMARY.md:120 msgid "Rc" msgstr "Rc" -#: src/SUMMARY.md:124 +#: src/SUMMARY.md:121 msgid "Cell/RefCell" -msgstr "" +msgstr "Cell/RefCell" -#: src/SUMMARY.md:125 src/modules.md:1 +#: src/SUMMARY.md:122 src/modules.md:1 msgid "Modules" msgstr "Modüller" -#: src/SUMMARY.md:126 src/modules/visibility.md:1 +#: src/SUMMARY.md:123 src/modules/visibility.md:1 msgid "Visibility" -msgstr "Görünebilirlik" +msgstr "Görünürlük" -#: src/SUMMARY.md:127 src/modules/paths.md:1 +#: src/SUMMARY.md:124 src/modules/paths.md:1 msgid "Paths" -msgstr "Yollar" +msgstr "Yollar (Paths)" -#: src/SUMMARY.md:128 src/modules/filesystem.md:1 +#: src/SUMMARY.md:125 src/modules/filesystem.md:1 msgid "Filesystem Hierarchy" msgstr "Dosya Sistemi Hiyerarşisi" -#: src/SUMMARY.md:130 src/exercises/day-2/strings-iterators.md:1 +#: src/SUMMARY.md:127 src/exercises/day-2/iterators-and-ownership.md:1 +msgid "Iterators and Ownership" +msgstr "Adımlayıcılar (Iterators) ve Sahiplik" + +#: src/SUMMARY.md:128 src/exercises/day-2/strings-iterators.md:1 #: src/exercises/day-2/solutions-afternoon.md:3 msgid "Strings and Iterators" -msgstr "Stringler ve Yineleyiciler" +msgstr "Dizeler (Stringler) ve Adımlayıcılar (Iterators)" -#: src/SUMMARY.md:133 +#: src/SUMMARY.md:131 msgid "Day 3: Morning" msgstr "Gün 3: Sabah" -#: src/SUMMARY.md:138 src/generics.md:1 +#: src/SUMMARY.md:136 src/generics.md:1 msgid "Generics" msgstr "Jenerikler" -#: src/SUMMARY.md:139 src/generics/data-types.md:1 +#: src/SUMMARY.md:137 src/generics/data-types.md:1 msgid "Generic Data Types" msgstr "Jenerik Veri Türleri" -#: src/SUMMARY.md:140 src/generics/methods.md:1 +#: src/SUMMARY.md:138 src/generics/methods.md:1 msgid "Generic Methods" msgstr "Jenerik Metotlar" -#: src/SUMMARY.md:141 src/generics/monomorphization.md:1 +#: src/SUMMARY.md:139 src/generics/monomorphization.md:1 msgid "Monomorphization" msgstr "Monomorfizasyon" -#: src/SUMMARY.md:142 src/traits.md:1 +#: src/SUMMARY.md:140 src/traits.md:1 msgid "Traits" -msgstr "Traitler" +msgstr "Özellikler (Traits)" -#: src/SUMMARY.md:143 src/traits/trait-objects.md:1 +#: src/SUMMARY.md:141 src/traits/trait-objects.md:1 msgid "Trait Objects" -msgstr "Trait Nesneleri" +msgstr "Özellik Nesneleri" -#: src/SUMMARY.md:144 src/traits/deriving-traits.md:1 +#: src/SUMMARY.md:142 src/traits/deriving-traits.md:1 msgid "Deriving Traits" -msgstr "Türeyen Traitler" +msgstr "Türetilebilir Özellikler (Traits)" -#: src/SUMMARY.md:145 src/traits/default-methods.md:1 +#: src/SUMMARY.md:143 src/traits/default-methods.md:1 msgid "Default Methods" msgstr "Varsayılan Metotlar" -#: src/SUMMARY.md:146 src/traits/trait-bounds.md:1 +#: src/SUMMARY.md:144 src/traits/trait-bounds.md:1 msgid "Trait Bounds" -msgstr "Trait Sınırları" +msgstr "Özellik (Trait) Sınırları" -#: src/SUMMARY.md:147 +#: src/SUMMARY.md:145 msgid "impl Trait" msgstr "impl Trait" -#: src/SUMMARY.md:148 src/traits/important-traits.md:1 +#: src/SUMMARY.md:146 src/traits/important-traits.md:1 msgid "Important Traits" -msgstr "Önemli Traitler" +msgstr "Önemli Özellikler (Traits)" -#: src/SUMMARY.md:149 +#: src/SUMMARY.md:147 msgid "Iterator" msgstr "Iterator" -#: src/SUMMARY.md:150 src/traits/from-iterator.md:1 +#: src/SUMMARY.md:148 src/traits/from-iterator.md:1 msgid "FromIterator" msgstr "FromIterator" -#: src/SUMMARY.md:151 +#: src/SUMMARY.md:149 msgid "From and Into" msgstr "From ve Into" -#: src/SUMMARY.md:152 +#: src/SUMMARY.md:150 msgid "Read and Write" msgstr "Read ve Write" -#: src/SUMMARY.md:153 +#: src/SUMMARY.md:151 msgid "Drop" msgstr "Drop" -#: src/SUMMARY.md:154 +#: src/SUMMARY.md:152 msgid "Default" msgstr "Default" -#: src/SUMMARY.md:155 +#: src/SUMMARY.md:153 msgid "Operators: Add, Mul, ..." msgstr "Operatörler: Add, Mul, ..." -#: src/SUMMARY.md:156 +#: src/SUMMARY.md:154 msgid "Closures: Fn, FnMut, FnOnce" -msgstr "TODO:" +msgstr "Kapanışlar (Closures): Fn, FnMut, FnOnce" -#: src/SUMMARY.md:158 src/exercises/day-3/simple-gui.md:1 -#: src/exercises/day-3/solutions-morning.md:3 +#: src/SUMMARY.md:156 msgid "A Simple GUI Library" msgstr "Basit bir GUI Kütüphanesi" -#: src/SUMMARY.md:159 src/exercises/day-3/solutions-morning.md:175 +#: src/SUMMARY.md:157 src/exercises/day-3/solutions-morning.md:142 msgid "Points and Polygons" msgstr "Noktalar ve Çokgenler" -#: src/SUMMARY.md:161 +#: src/SUMMARY.md:159 msgid "Day 3: Afternoon" msgstr "Gün 3: Öğleden Sonra" -#: src/SUMMARY.md:163 src/error-handling.md:1 +#: src/SUMMARY.md:161 src/error-handling.md:1 msgid "Error Handling" -msgstr "Hata Yönetimi" +msgstr "Hata İşleme" -#: src/SUMMARY.md:164 src/error-handling/panics.md:1 +#: src/SUMMARY.md:162 src/error-handling/panics.md:1 msgid "Panics" msgstr "Panikler" -#: src/SUMMARY.md:165 +#: src/SUMMARY.md:163 msgid "Catching Stack Unwinding" -msgstr "TODO:" +msgstr "Yığın Geri Sarımınının Yakalanması" -#: src/SUMMARY.md:166 +#: src/SUMMARY.md:164 msgid "Structured Error Handling" -msgstr "Yapılandırılmış Hata Yönetimi" +msgstr "Yapılandırılmış Hata İşlemesi" -#: src/SUMMARY.md:167 +#: src/SUMMARY.md:165 msgid "Propagating Errors with ?" -msgstr "? ile Hata Döndürme" +msgstr "? ile Hataların Yayılması" -#: src/SUMMARY.md:168 src/error-handling/converting-error-types.md:1 +#: src/SUMMARY.md:166 src/error-handling/converting-error-types.md:1 #: src/error-handling/converting-error-types-example.md:1 msgid "Converting Error Types" -msgstr "Hata Türlerini Dönüştürme" +msgstr "Hata Türlerinin Dönüştürülmesi" -#: src/SUMMARY.md:170 src/error-handling/deriving-error-enums.md:1 +#: src/SUMMARY.md:168 src/error-handling/deriving-error-enums.md:1 msgid "Deriving Error Enums" -msgstr "Hata Enumlarını Türetme" +msgstr "Hata Enumlarının Türetilmesi" -#: src/SUMMARY.md:171 src/error-handling/dynamic-errors.md:1 +#: src/SUMMARY.md:169 src/error-handling/dynamic-errors.md:1 msgid "Dynamic Error Types" msgstr "Dinamik Hata Türleri" -#: src/SUMMARY.md:172 src/error-handling/error-contexts.md:1 +#: src/SUMMARY.md:170 src/error-handling/error-contexts.md:1 msgid "Adding Context to Errors" -msgstr "Hatalara Bağlam Ekleme" +msgstr "Hatalara Bağlam (Context) Ekleme" -#: src/SUMMARY.md:173 src/testing.md:1 +#: src/SUMMARY.md:171 src/testing.md:1 msgid "Testing" msgstr "Test Etme" -#: src/SUMMARY.md:174 src/testing/unit-tests.md:1 +#: src/SUMMARY.md:172 src/testing/unit-tests.md:1 msgid "Unit Tests" msgstr "Birim Testleri" -#: src/SUMMARY.md:175 src/testing/test-modules.md:1 +#: src/SUMMARY.md:173 src/testing/test-modules.md:1 msgid "Test Modules" msgstr "Test Modülleri" -#: src/SUMMARY.md:176 src/testing/doc-tests.md:1 +#: src/SUMMARY.md:174 src/testing/doc-tests.md:1 msgid "Documentation Tests" msgstr "Dokümantasyon Testleri" -#: src/SUMMARY.md:177 src/testing/integration-tests.md:1 +#: src/SUMMARY.md:175 src/testing/integration-tests.md:1 msgid "Integration Tests" msgstr "Entegrasyon Testleri" -#: src/SUMMARY.md:178 src/bare-metal/useful-crates.md:1 +#: src/SUMMARY.md:176 src/bare-metal/useful-crates.md:1 msgid "Useful crates" -msgstr "Yararlı crateler" +msgstr "Kullanışlı sandıklar (crates)" -#: src/SUMMARY.md:179 src/unsafe.md:1 +#: src/SUMMARY.md:177 src/unsafe.md:1 msgid "Unsafe Rust" -msgstr "Güvensiz Rust" +msgstr "Güvensiz (Unsafe) Rust" -#: src/SUMMARY.md:180 src/unsafe/raw-pointers.md:1 +#: src/SUMMARY.md:178 src/unsafe/raw-pointers.md:1 msgid "Dereferencing Raw Pointers" -msgstr "Saf İşaretçilerin Referansını Kaldırma" +msgstr "Ham Göstericilerinin İçeriği (Dereferencing)" -#: src/SUMMARY.md:181 src/unsafe/mutable-static-variables.md:1 +#: src/SUMMARY.md:179 src/unsafe/mutable-static-variables.md:1 msgid "Mutable Static Variables" -msgstr "Değişebilir Statik Değişlenler" +msgstr "Değiştirilebilir Statik Değişkenler" -#: src/SUMMARY.md:182 src/unsafe/unions.md:1 +#: src/SUMMARY.md:180 src/unsafe/unions.md:1 msgid "Unions" -msgstr "Unionlar" +msgstr "Birlikler (Unions)" -#: src/SUMMARY.md:183 src/unsafe/calling-unsafe-functions.md:1 +#: src/SUMMARY.md:181 src/unsafe/calling-unsafe-functions.md:1 msgid "Calling Unsafe Functions" -msgstr "Güvensiz Fonksiyonları Çağırma" +msgstr "Güvensiz (Unsafe) Fonksiyonları Çağırma" -#: src/SUMMARY.md:184 src/unsafe/writing-unsafe-functions.md:1 +#: src/SUMMARY.md:182 src/unsafe/writing-unsafe-functions.md:1 msgid "Writing Unsafe Functions" -msgstr "Güvensiz Fonksiyonlar Yazma" +msgstr "Güvensiz (Unsafe) Fonksiyonlar Yazma" -#: src/SUMMARY.md:185 +#: src/SUMMARY.md:183 msgid "Extern Functions" -msgstr "Dış Fonksiyonlar" +msgstr "Dış Bağlantıya Sahip Fonksiyonlar" -#: src/SUMMARY.md:186 src/unsafe/unsafe-traits.md:1 +#: src/SUMMARY.md:184 src/unsafe/unsafe-traits.md:1 msgid "Implementing Unsafe Traits" -msgstr "Güvensiz Traitleri Ekleme" +msgstr "Güvensiz Özelliklerin (Unsafe Traits) Gerçekleştirilmesi" -#: src/SUMMARY.md:188 src/exercises/day-3/safe-ffi-wrapper.md:1 +#: src/SUMMARY.md:186 src/exercises/day-3/safe-ffi-wrapper.md:1 #: src/exercises/day-3/solutions-afternoon.md:3 msgid "Safe FFI Wrapper" -msgstr "Güvenli FFI Sarıcı" +msgstr "Güvenli FFI Sarıcı (Wrapper)" -#: src/SUMMARY.md:191 src/SUMMARY.md:261 src/bare-metal/android.md:1 +#: src/SUMMARY.md:189 src/SUMMARY.md:259 src/bare-metal/android.md:1 msgid "Android" msgstr "Android" -#: src/SUMMARY.md:196 src/android/setup.md:1 +#: src/SUMMARY.md:194 src/android/setup.md:1 msgid "Setup" -msgstr "Kurulum" +msgstr "Kurulum (Setup)" -#: src/SUMMARY.md:197 src/android/build-rules.md:1 +#: src/SUMMARY.md:195 src/android/build-rules.md:1 msgid "Build Rules" -msgstr "Oluşturma Kuralları" +msgstr "İnşa (Build) Kuralları" -#: src/SUMMARY.md:198 +#: src/SUMMARY.md:196 msgid "Binary" -msgstr "Çalıştırılabilir Dosya" +msgstr "İkili (Binary) Dosya" -#: src/SUMMARY.md:199 +#: src/SUMMARY.md:197 msgid "Library" msgstr "Kütüphane" -#: src/SUMMARY.md:200 src/android/aidl.md:1 +#: src/SUMMARY.md:198 src/android/aidl.md:1 msgid "AIDL" msgstr "AIDL" -#: src/SUMMARY.md:201 +#: src/SUMMARY.md:199 msgid "Interface" msgstr "Arayüz" -#: src/SUMMARY.md:202 +#: src/SUMMARY.md:200 msgid "Implementation" -msgstr "Ekleme" +msgstr "Gerçekleştirim" -#: src/SUMMARY.md:203 +#: src/SUMMARY.md:201 msgid "Server" msgstr "Sunucu" -#: src/SUMMARY.md:204 src/android/aidl/deploy.md:1 +#: src/SUMMARY.md:202 src/android/aidl/deploy.md:1 msgid "Deploy" -msgstr "Başlatma" +msgstr "Dağıtmak (Deploy)" -#: src/SUMMARY.md:205 +#: src/SUMMARY.md:203 msgid "Client" -msgstr "Alıcı" +msgstr "İstemci" -#: src/SUMMARY.md:206 src/android/aidl/changing.md:1 +#: src/SUMMARY.md:204 src/android/aidl/changing.md:1 msgid "Changing API" msgstr "API'yi Değiştirme" -#: src/SUMMARY.md:207 src/SUMMARY.md:251 src/android/logging.md:1 +#: src/SUMMARY.md:205 src/SUMMARY.md:249 src/android/logging.md:1 #: src/bare-metal/aps/logging.md:1 msgid "Logging" -msgstr "TODO: NOTE:Günlükleme Olabilir" +msgstr "Kayıt Tutma (Logging)" -#: src/SUMMARY.md:208 src/android/interoperability.md:1 +#: src/SUMMARY.md:206 src/android/interoperability.md:1 msgid "Interoperability" msgstr "Birlikte Çalışabilirlik" -#: src/SUMMARY.md:209 +#: src/SUMMARY.md:207 msgid "With C" msgstr "C ile" -#: src/SUMMARY.md:210 +#: src/SUMMARY.md:208 msgid "Calling C with Bindgen" -msgstr "Bindgen ile C Kullanma" +msgstr "Bindgen ile Rust Tarafından C'yi Kullanma" -#: src/SUMMARY.md:211 +#: src/SUMMARY.md:209 msgid "Calling Rust from C" -msgstr "C ile Rust Kullanma" +msgstr "C Tarafından Rust'ı Kullanma" -#: src/SUMMARY.md:212 src/android/interoperability/cpp.md:1 +#: src/SUMMARY.md:210 src/android/interoperability/cpp.md:1 msgid "With C++" msgstr "C++ ile" -#: src/SUMMARY.md:213 +#: src/SUMMARY.md:211 msgid "With Java" msgstr "Java ile" -#: src/SUMMARY.md:217 +#: src/SUMMARY.md:215 msgid "Bare Metal: Morning" -msgstr "" +msgstr "Yalın Metal (Bare Metal): Sabah" + +#: src/SUMMARY.md:220 +msgid "no_std" +msgstr "no_std" + +#: src/SUMMARY.md:221 +msgid "A Minimal Example" +msgstr "Minimal Bir Örnek" #: src/SUMMARY.md:222 -msgid "no_std" -msgstr "" - -#: src/SUMMARY.md:223 -msgid "A Minimal Example" -msgstr "" - -#: src/SUMMARY.md:224 msgid "alloc" -msgstr "" +msgstr "alloc" -#: src/SUMMARY.md:225 src/bare-metal/microcontrollers.md:1 +#: src/SUMMARY.md:223 src/bare-metal/microcontrollers.md:1 msgid "Microcontrollers" -msgstr "" +msgstr "Mikrodenetleyiciler" -#: src/SUMMARY.md:226 src/bare-metal/microcontrollers/mmio.md:1 +#: src/SUMMARY.md:224 src/bare-metal/microcontrollers/mmio.md:1 msgid "Raw MMIO" -msgstr "" +msgstr "Ham MMIO" + +#: src/SUMMARY.md:225 +msgid "PACs" +msgstr "PAC'ler" + +#: src/SUMMARY.md:226 +msgid "HAL Crates" +msgstr "HAL Sandıkları (Crates)" #: src/SUMMARY.md:227 -msgid "PACs" -msgstr "" +msgid "Board Support Crates" +msgstr "Kart Destek Sandıkları (Board Support Crates)" #: src/SUMMARY.md:228 -msgid "HAL Crates" -msgstr "" +msgid "The Type State Pattern" +msgstr "Tür Durum Deseni" #: src/SUMMARY.md:229 -msgid "Board Support Crates" -msgstr "" +msgid "embedded-hal" +msgstr "embedded-hal" #: src/SUMMARY.md:230 -msgid "The Type State Pattern" -msgstr "" - -#: src/SUMMARY.md:231 -msgid "embedded-hal" -msgstr "" - -#: src/SUMMARY.md:232 msgid "probe-rs, cargo-embed" -msgstr "" +msgstr "probe-rs, cargo-embed" -#: src/SUMMARY.md:233 src/bare-metal/microcontrollers/debugging.md:1 +#: src/SUMMARY.md:231 src/bare-metal/microcontrollers/debugging.md:1 msgid "Debugging" -msgstr "" +msgstr "Hata Ayıklama" -#: src/SUMMARY.md:234 src/SUMMARY.md:254 +#: src/SUMMARY.md:232 src/SUMMARY.md:252 msgid "Other Projects" -msgstr "" +msgstr "Diğer Projeler" -#: src/SUMMARY.md:236 src/exercises/bare-metal/compass.md:1 +#: src/SUMMARY.md:234 src/exercises/bare-metal/compass.md:1 #: src/exercises/bare-metal/solutions-morning.md:3 msgid "Compass" -msgstr "" +msgstr "Pusula" + +#: src/SUMMARY.md:236 +msgid "Bare Metal: Afternoon" +msgstr "Yalın Metal (Bare Metal): Öğleden Sonra" #: src/SUMMARY.md:238 -msgid "Bare Metal: Afternoon" -msgstr "" +msgid "Application Processors" +msgstr "Uygulama İşlemcileri" + +#: src/SUMMARY.md:239 src/bare-metal/aps/entry-point.md:1 +msgid "Getting Ready to Rust" +msgstr "Rust'a Hazırlanmak" #: src/SUMMARY.md:240 -msgid "Application Processors" -msgstr "" +msgid "Inline Assembly" +msgstr "Satır İçi Assembly" -#: src/SUMMARY.md:241 src/bare-metal/aps/entry-point.md:1 -msgid "Getting Ready to Rust" -msgstr "" +#: src/SUMMARY.md:241 +msgid "MMIO" +msgstr "MMIO" #: src/SUMMARY.md:242 -msgid "Inline Assembly" -msgstr "" +msgid "Let's Write a UART Driver" +msgstr "Bir UART Sürücü Yazalım" #: src/SUMMARY.md:243 -msgid "MMIO" -msgstr "" +msgid "More Traits" +msgstr "Daha Fazla Özellik (Trait)" #: src/SUMMARY.md:244 -msgid "Let's Write a UART Driver" -msgstr "" +msgid "A Better UART Driver" +msgstr "Daha İyi Bir UART Sürücüsü" -#: src/SUMMARY.md:245 -msgid "More Traits" -msgstr "" +#: src/SUMMARY.md:245 src/bare-metal/aps/better-uart/bitflags.md:1 +msgid "Bitflags" +msgstr "Bitflags Sandığı" #: src/SUMMARY.md:246 -msgid "A Better UART Driver" -msgstr "" - -#: src/SUMMARY.md:247 src/bare-metal/aps/better-uart/bitflags.md:1 -msgid "Bitflags" -msgstr "" - -#: src/SUMMARY.md:248 msgid "Multiple Registers" -msgstr "" +msgstr "Çoklu Yazmaçlar (Registers)" -#: src/SUMMARY.md:249 src/bare-metal/aps/better-uart/driver.md:1 +#: src/SUMMARY.md:247 src/bare-metal/aps/better-uart/driver.md:1 msgid "Driver" -msgstr "" +msgstr "Sürücü" -#: src/SUMMARY.md:250 src/SUMMARY.md:252 +#: src/SUMMARY.md:248 src/SUMMARY.md:250 msgid "Using It" -msgstr "" +msgstr "Onu Kullan" -#: src/SUMMARY.md:253 src/bare-metal/aps/exceptions.md:1 -#, fuzzy +#: src/SUMMARY.md:251 src/bare-metal/aps/exceptions.md:1 msgid "Exceptions" -msgstr "Fonksiyonlar" +msgstr "İstisnalar" + +#: src/SUMMARY.md:253 +msgid "Useful Crates" +msgstr "Kullanışlı Sandıklar (Crates)" + +#: src/SUMMARY.md:254 +msgid "zerocopy" +msgstr "zerocopy" #: src/SUMMARY.md:255 -msgid "Useful Crates" -msgstr "" +msgid "aarch64-paging" +msgstr "aarch64-paging" #: src/SUMMARY.md:256 -msgid "zerocopy" -msgstr "" +msgid "buddy_system_allocator" +msgstr "buddy_system_allocator" #: src/SUMMARY.md:257 -msgid "aarch64-paging" -msgstr "" +msgid "tinyvec" +msgstr "tinyvec" #: src/SUMMARY.md:258 -msgid "buddy_system_allocator" -msgstr "" - -#: src/SUMMARY.md:259 -msgid "tinyvec" -msgstr "" - -#: src/SUMMARY.md:260 msgid "spin" -msgstr "" +msgstr "spin" -#: src/SUMMARY.md:262 src/bare-metal/android/vmbase.md:1 +#: src/SUMMARY.md:260 src/bare-metal/android/vmbase.md:1 msgid "vmbase" -msgstr "" +msgstr "vmbase" -#: src/SUMMARY.md:264 +#: src/SUMMARY.md:262 msgid "RTC Driver" -msgstr "" +msgstr "RTC Sürücüsü" -#: src/SUMMARY.md:267 +#: src/SUMMARY.md:265 msgid "Concurrency: Morning" -msgstr "" +msgstr "Eşzamanlılık: Sabah" -#: src/SUMMARY.md:272 src/concurrency/threads.md:1 +#: src/SUMMARY.md:270 src/concurrency/threads.md:1 msgid "Threads" -msgstr "" +msgstr "İş Parçacıkları (Threads)" -#: src/SUMMARY.md:273 src/concurrency/scoped-threads.md:1 +#: src/SUMMARY.md:271 src/concurrency/scoped-threads.md:1 msgid "Scoped Threads" -msgstr "" +msgstr "Kapsamlı İş Parçacıkları (Threads)" -#: src/SUMMARY.md:274 src/concurrency/channels.md:1 +#: src/SUMMARY.md:272 src/concurrency/channels.md:1 msgid "Channels" -msgstr "" +msgstr "Kanallar" -#: src/SUMMARY.md:275 src/concurrency/channels/unbounded.md:1 +#: src/SUMMARY.md:273 src/concurrency/channels/unbounded.md:1 msgid "Unbounded Channels" -msgstr "" +msgstr "Sınırsız Kanallar" -#: src/SUMMARY.md:276 src/concurrency/channels/bounded.md:1 +#: src/SUMMARY.md:274 src/concurrency/channels/bounded.md:1 msgid "Bounded Channels" -msgstr "" +msgstr "Sınırlı Kanallar" -#: src/SUMMARY.md:277 +#: src/SUMMARY.md:275 msgid "Send and Sync" -msgstr "" +msgstr "Send ve Sync" -#: src/SUMMARY.md:277 +#: src/SUMMARY.md:275 msgid "Send" -msgstr "" +msgstr "Send" -#: src/SUMMARY.md:277 +#: src/SUMMARY.md:275 msgid "Sync" -msgstr "" +msgstr "Sync" -#: src/SUMMARY.md:280 src/concurrency/send-sync/examples.md:1 +#: src/SUMMARY.md:278 src/concurrency/send-sync/examples.md:1 msgid "Examples" -msgstr "" +msgstr "Örnekler" -#: src/SUMMARY.md:281 src/concurrency/shared_state.md:1 +#: src/SUMMARY.md:279 src/concurrency/shared_state.md:1 msgid "Shared State" -msgstr "" +msgstr "Paylaşımlı Durum (State)" -#: src/SUMMARY.md:282 +#: src/SUMMARY.md:280 msgid "Arc" -msgstr "" +msgstr "Arc" -#: src/SUMMARY.md:283 +#: src/SUMMARY.md:281 msgid "Mutex" -msgstr "" +msgstr "Mutex" -#: src/SUMMARY.md:286 src/SUMMARY.md:307 +#: src/SUMMARY.md:284 src/SUMMARY.md:305 #: src/exercises/concurrency/dining-philosophers.md:1 #: src/exercises/concurrency/solutions-morning.md:3 msgid "Dining Philosophers" -msgstr "" +msgstr "Filozofların Akşam Yemeği" -#: src/SUMMARY.md:287 src/exercises/concurrency/link-checker.md:1 +#: src/SUMMARY.md:285 src/exercises/concurrency/link-checker.md:1 msgid "Multi-threaded Link Checker" -msgstr "" +msgstr "Çok İş Parçacıklı Link Denetleyicisi" + +#: src/SUMMARY.md:287 +msgid "Concurrency: Afternoon" +msgstr "Eşzamanlılık: Öğleden Sonra" #: src/SUMMARY.md:289 -msgid "Concurrency: Afternoon" -msgstr "" - -#: src/SUMMARY.md:291 msgid "Async Basics" -msgstr "" +msgstr "Async Temelleri" -#: src/SUMMARY.md:292 +#: src/SUMMARY.md:290 msgid "async/await" -msgstr "" +msgstr "async/await" -#: src/SUMMARY.md:293 src/async/futures.md:1 +#: src/SUMMARY.md:291 src/async/futures.md:1 msgid "Futures" -msgstr "" +msgstr "Future Özellikleri (Traits)" -#: src/SUMMARY.md:294 src/async/runtimes.md:1 +#: src/SUMMARY.md:292 src/async/runtimes.md:1 msgid "Runtimes" -msgstr "" +msgstr "Çalışma Zamanları" -#: src/SUMMARY.md:295 src/async/runtimes/tokio.md:1 +#: src/SUMMARY.md:293 src/async/runtimes/tokio.md:1 msgid "Tokio" -msgstr "" +msgstr "Tokio Sandığı" -#: src/SUMMARY.md:296 src/exercises/concurrency/link-checker.md:126 -#: src/async/tasks.md:1 src/exercises/concurrency/chat-app.md:140 +#: src/SUMMARY.md:294 src/exercises/concurrency/link-checker.md:126 +#: src/async/tasks.md:1 src/exercises/concurrency/chat-app.md:143 msgid "Tasks" -msgstr "" +msgstr "Görevler" -#: src/SUMMARY.md:297 src/async/channels.md:1 +#: src/SUMMARY.md:295 src/async/channels.md:1 msgid "Async Channels" -msgstr "" +msgstr "Async Kanalları" -#: src/SUMMARY.md:299 src/async/control-flow/join.md:1 +#: src/SUMMARY.md:297 src/async/control-flow/join.md:1 msgid "Join" -msgstr "" +msgstr "Join" -#: src/SUMMARY.md:300 src/async/control-flow/select.md:1 +#: src/SUMMARY.md:298 src/async/control-flow/select.md:1 msgid "Select" -msgstr "" +msgstr "Select" -#: src/SUMMARY.md:301 +#: src/SUMMARY.md:299 msgid "Pitfalls" -msgstr "" +msgstr "Tuzaklar" -#: src/SUMMARY.md:302 +#: src/SUMMARY.md:300 msgid "Blocking the Executor" -msgstr "" +msgstr "Yürütücünün/Çalıştırıcının (Executor) Engellenmesi" -#: src/SUMMARY.md:303 src/async/pitfalls/pin.md:1 +#: src/SUMMARY.md:301 src/async/pitfalls/pin.md:1 msgid "Pin" -msgstr "" +msgstr "Pin" -#: src/SUMMARY.md:304 src/async/pitfalls/async-traits.md:1 +#: src/SUMMARY.md:302 src/async/pitfalls/async-traits.md:1 msgid "Async Traits" -msgstr "" +msgstr "Async Özellikleri (Traits)" -#: src/SUMMARY.md:305 src/async/pitfalls/cancellation.md:1 -#, fuzzy +#: src/SUMMARY.md:303 src/async/pitfalls/cancellation.md:1 msgid "Cancellation" -msgstr "Çeviriler" +msgstr "İptal (Cancellation)" -#: src/SUMMARY.md:308 src/exercises/concurrency/chat-app.md:1 -#: src/exercises/concurrency/solutions-afternoon.md:119 +#: src/SUMMARY.md:306 src/exercises/concurrency/chat-app.md:1 +#: src/exercises/concurrency/solutions-afternoon.md:95 msgid "Broadcast Chat Application" -msgstr "" +msgstr "Yayımlamalı Sohbet Uygulaması" -#: src/SUMMARY.md:311 +#: src/SUMMARY.md:309 msgid "Final Words" -msgstr "" +msgstr "Son sözler" -#: src/SUMMARY.md:315 src/thanks.md:1 +#: src/SUMMARY.md:313 src/thanks.md:1 msgid "Thanks!" -msgstr "" +msgstr "Teşekkürler!" -#: src/SUMMARY.md:316 +#: src/SUMMARY.md:314 src/glossary.md:1 +msgid "Glossary" +msgstr "Sözlük" + +#: src/SUMMARY.md:315 msgid "Other Resources" -msgstr "" +msgstr "Diğer Kaynaklar" -#: src/SUMMARY.md:317 src/credits.md:1 +#: src/SUMMARY.md:316 src/credits.md:1 msgid "Credits" -msgstr "" +msgstr "Emekler" -#: src/SUMMARY.md:320 src/exercises/solutions.md:1 +#: src/SUMMARY.md:319 src/exercises/solutions.md:1 msgid "Solutions" -msgstr "" +msgstr "Çözümler" + +#: src/SUMMARY.md:324 +msgid "Day 1 Morning" +msgstr "1. Gün Sabah" #: src/SUMMARY.md:325 -msgid "Day 1 Morning" -msgstr "" +msgid "Day 1 Afternoon" +msgstr "1. Gün Öğleden Sonra" #: src/SUMMARY.md:326 -msgid "Day 1 Afternoon" -msgstr "" +msgid "Day 2 Morning" +msgstr "2. Gün Sabah" #: src/SUMMARY.md:327 -msgid "Day 2 Morning" -msgstr "" +msgid "Day 2 Afternoon" +msgstr "2. Gün Öüleden Sonra" #: src/SUMMARY.md:328 -msgid "Day 2 Afternoon" -msgstr "" +msgid "Day 3 Morning" +msgstr "3. Gün Sabah" #: src/SUMMARY.md:329 -msgid "Day 3 Morning" -msgstr "" +msgid "Day 3 Afternoon" +msgstr "3. Gün Öğleden Sonra" #: src/SUMMARY.md:330 -msgid "Day 3 Afternoon" -msgstr "" - -#: src/SUMMARY.md:331 msgid "Bare Metal Rust Morning" -msgstr "" +msgstr "Yalın (Bare) Metal Rust Sabah" -#: src/SUMMARY.md:332 src/exercises/bare-metal/solutions-afternoon.md:1 +#: src/SUMMARY.md:331 src/exercises/bare-metal/solutions-afternoon.md:1 msgid "Bare Metal Rust Afternoon" -msgstr "" +msgstr "Yalın (Bare) Metal Rust Öğleden Sonra" + +#: src/SUMMARY.md:332 +msgid "Concurrency Morning" +msgstr "Eşzamanlılık Sabah" #: src/SUMMARY.md:333 -msgid "Concurrency Morning" -msgstr "" - -#: src/SUMMARY.md:334 msgid "Concurrency Afternoon" -msgstr "" +msgstr "Eşzamanlılık Öğleden Sonra" #: src/index.md:3 msgid "" @@ -1048,6 +1043,14 @@ msgid "" "io/github/stars/google/comprehensive-rust?style=flat-square)](https://github." "com/google/comprehensive-rust/stargazers)" msgstr "" +"[![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) [![GitHub stars](https://img.shields." +"io/github/stars/google/comprehensive-rust?style=flat-square)](https://github." +"com/google/comprehensive-rust/stargazers)" #: src/index.md:7 msgid "" @@ -1055,111 +1058,172 @@ msgid "" "course covers the full spectrum of Rust, from basic syntax to advanced " "topics like generics and error handling." msgstr "" +"Bu, Google'daki Android ekibi tarafından geliştirilen ücretsiz bir Rust " +"kursudur. Kurs, temel sözdiziminden jenerikler ve hata işleme gibi ileri " +"düzey konulara kadar Rust'ın tüm yelpazesini kapsar." #: 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 "" +"Kursun en son sürümüne " +"adresinden ulaşılabilir. Başka bir yerde okuyorsanız, lütfen güncellemeleri " +"kontrol edin." + +#: 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:" msgstr "" - -#: src/index.md:14 -msgid "Give you a comprehensive understanding of the Rust syntax and language." -msgstr "" - -#: src/index.md:15 -msgid "Enable you to modify existing programs and write new programs in Rust." -msgstr "" - -#: src/index.md:16 -msgid "Show you common Rust idioms." -msgstr "" +"Kursun amacı size Rust'ı öğretmektir. Rust hakkında hiçbir şey bilmediğinizi " +"varsayıyoruz ve şunu umuyoruz:" #: src/index.md:18 -msgid "We call the first three course days Rust Fundamentals." +msgid "Give you a comprehensive understanding of the Rust syntax and language." +msgstr "Rust sözdizimi ve dili hakkında kapsamlı bir anlayış sunmayı." + +#: src/index.md:19 +msgid "Enable you to modify existing programs and write new programs in Rust." msgstr "" +"Rust'ta mevcut programları değiştirmenize ve yeni programlar yazmanıza " +"olanak sağlamayı." #: src/index.md:20 +msgid "Show you common Rust idioms." +msgstr "Yaygın Rust kod kaplarını göstermeyi." + +#: src/index.md:22 +msgid "We call the first three course days Rust Fundamentals." +msgstr "İlk üç kurs gününe Rust Esasları (Rust Fundamentals) adını veriyoruz." + +#: src/index.md:24 msgid "" "Building on this, you're invited to dive into one or more specialized topics:" msgstr "" +"Buna dayanarak, bir veya daha fazla uzmanlık konusuna dalmaya davetlisiniz:" -#: src/index.md:22 +#: 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." msgstr "" +"[Android](android.md): Android platformu geliştirme (AOSP) için Rust'ın " +"kullanımına ilişkin yarım günlük bir kurs. Buna C, C++ ve Java ile birlikte " +"çalışabilirlik de dahildir." -#: src/index.md:24 +#: 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 " "covered." msgstr "" +"[Yalın-metal](bare-metal.md): Yalın metal (gömülü) geliştirme için Rust'ın " +"kullanımına ilişkin tam günlük bir ders. Hem mikrodenetleyiciler hem de " +"uygulama işlemcileri kapsanmaktadır." -#: src/index.md:27 +#: 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 " "mutexes) and async/await concurrency (cooperative multitasking using " "futures)." msgstr "" +"[Eşzamanlılık](concurrency.md): Rust'ta eşzamanlılık üzerine tam günlük bir " +"ders. Hem klasik eşzamanlılığı (iş parçacıkları ve mutexleri kullanarak " +"kesintili/geçişli zamanlama) hem de async/await eşzamanlılığını (future " +"özelliklerini kullanarak işbirlikçi çoklu görev) ele alıyoruz." -#: src/index.md:33 +#: src/index.md:37 msgid "Non-Goals" -msgstr "" +msgstr "Hedef Dışı" -#: src/index.md:35 +#: 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:" msgstr "" +"Rust geniş bir dil ve birkaç gün içinde tamamını ele almamız mümkün " +"olmayacak. Aşağıdakiler bu kursun amaçları dışında kalır:" -#: src/index.md:38 +#: src/index.md:42 msgid "" "Learning how to develop macros: please see [Chapter 19.5 in the Rust Book]" "(https://doc.rust-lang.org/book/ch19-06-macros.html) and [Rust by Example]" "(https://doc.rust-lang.org/rust-by-example/macros.html) instead." msgstr "" +"Makroların nasıl geliştirileceğini öğrenmek: lütfen bunun yerine [Rust " +"Book'ta Bölüm 19.5](https://doc.rust-lang.org/book/ch19-06-macros.html) ve " +"[Örneklerle Rust](https://doc.rust-lang.org/rust-by-example/macros.html) " +"bakınız." -#: src/index.md:42 +#: src/index.md:46 msgid "Assumptions" -msgstr "" +msgstr "Varsayımlar" -#: src/index.md:44 +#: src/index.md:48 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 " "C++ to better explain or contrast the Rust approach." msgstr "" +"Kurs, nasıl programlanacağını zaten bildiğinizi varsayar. Rust, statik " +"olarak yazılmış bir dildir ve Rust yaklaşımını daha iyi açıklamak veya " +"karşılaştırmak için bazen C ve C++ ile karşılaştırmalar yapacağız." -#: src/index.md:48 +#: src/index.md:52 msgid "" "If you know how to program in a dynamically-typed language such as Python or " "JavaScript, then you will be able to follow along just fine too." msgstr "" +"Python veya JavaScript gibi dinamik olarak yazılmış bir dilde nasıl " +"programlanacağını biliyorsanız, o zaman da gayet iyi takip edebileceksiniz." -#: src/index.md:53 +#: 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 " "should cover as well as answers to typical questions which come up in class." msgstr "" +"Bu bir _konuşmacı notu_ örneğidir. Bunları slaytlara ek bilgi eklemek için " +"kullanacağız. Bunlar, eğitmenin ele alması gereken önemli noktaların yanı " +"sıra sınıfta ortaya çıkan tipik soruların yanıtları da olabilir." #: src/running-the-course.md:3 src/running-the-course/course-structure.md:3 msgid "This page is for the course instructor." -msgstr "" +msgstr "Bu sayfa kurs eğitmenine yöneliktir." #: src/running-the-course.md:5 msgid "" "Here is a bit of background information about how we've been running the " "course internally at Google." msgstr "" +"Kursu Google'da dahili olarak nasıl kullandığımıza dair biraz arka plan " +"bilgisini burada bulabilirsiniz." #: src/running-the-course.md:8 -msgid "Before you run the course, you will want to:" +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 "" +"Dersleri genellikle sabah 10:00'dan akşam 16:00'ya kadar yürütüyoruz ve " +"ortasında 1 saatlik öğle yemeği molası veriyoruz. Geriye sabah dersi için " +"2.5 saat, öğleden sonra dersi için ise 2.5 saat kalıyor. Bunun sadece bir " +"öneri olduğunu unutmayın: İnsanlara egzersiz için daha fazla zaman tanımak " +"için sabah seansına da 3 saat ayırabilirsiniz. Daha uzun seansların " +"dezavantajı, 16.00'dan sonra yani 6 saatlik dersten sonra insanların çok " +"yorulabilmesidir." -#: src/running-the-course.md:10 +#: src/running-the-course.md:16 +msgid "Before you run the course, you will want to:" +msgstr "Kursu çalıştırmadan önce şunları yapmak isteyeceksiniz:" + +#: src/running-the-course.md:18 msgid "" "Make yourself familiar with the course material. We've included speaker " "notes to help highlight the key points (please help us by contributing more " @@ -1167,16 +1231,26 @@ msgid "" "notes in a popup (click the link with a little arrow next to \"Speaker " "Notes\"). This way you have a clean screen to present to the class." msgstr "" +"Ders materyaline aşina olun. Önemli noktaların vurgulanmasına yardımcı olmak " +"için konuşmacı notları ekledik (lütfen daha fazla konuşmacı notuna katkıda " +"bulunarak bize yardımcı olun!). Sunum yaparken, konuşmacı notlarını açılır " +"pencerede açtığınızdan emin olmalısınız (\"Konuşmacı Notları\"nın yanındaki " +"küçük oklu bağlantıya tıklayın). Bu şekilde sınıfa sunacağınız temiz bir " +"ekrana sahip olursunuz." -#: src/running-the-course.md:16 +#: src/running-the-course.md:24 msgid "" "Decide on the dates. Since the course takes at least three full days, we " "recommend that you schedule the days over two weeks. Course participants " "have said that they find it helpful to have a gap in the course since it " "helps them process all the information we give them." msgstr "" +"Tarihlere karar verin. Kurs en az üç tam gün sürdüğünden, günleri iki " +"haftaya yaymanızı öneririz. Kurs katılımcıları, kursta boşluk kalmasının, " +"onlara verdiğimiz tüm bilgileri işlemelerine yardımcı olması açısından " +"yararlı bulduklarını belirtmişlerdir." -#: src/running-the-course.md:21 +#: src/running-the-course.md:29 msgid "" "Find a room large enough for your in-person participants. We recommend a " "class size of 15-25 people. That's small enough that people are comfortable " @@ -1186,8 +1260,15 @@ msgid "" "laptops. In particular, you will be doing a lot of live-coding as an " "instructor, so a lectern won't be very helpful for you." msgstr "" +"Katılımcılarınız için yeterince büyük bir oda bulun. Sınıf mevcudunun 15-25 " +"kişilik olmasını öneriyoruz. Bu, insanların rahatça soru sorabileceği kadar " +"küçüktür --- aynı zamanda bir eğitmenin soruları yanıtlamak için zamanının " +"olacağı kadar da küçüktür. Odada kendiniz ve öğrencileriniz için _masaların_ " +"olduğundan emin olun: hepinizin oturup dizüstü bilgisayarlarınızla " +"çalışabilmesi gerekir. Özellikle eğitmen olarak çok sayıda canlı kodlama " +"yapacaksınız, bu nedenle kürsü size pek yardımcı olmayacaktır." -#: src/running-the-course.md:29 +#: src/running-the-course.md:37 msgid "" "On the day of your course, show up to the room a little early to set things " "up. We recommend presenting directly using `mdbook serve` running on your " @@ -1196,8 +1277,15 @@ msgid "" "as you change pages. Using your laptop will also allow you to fix typos as " "you or the course participants spot them." msgstr "" +"Kurs gününüzde, işleri ayarlamak için odaya biraz erken gelin. Doğrudan " +"dizüstü bilgisayarınızda çalışan `mdbook serve` komutunu kullanarak sunum " +"yapmanızı öneririz ([kurulum talimatlarına](https://github.com/google/" +"comprehensive-rust#building) bakın). Bu, sayfaları değiştirirken gecikme " +"olmadan en iyi performansı sağlar. Dizüstü bilgisayarınızı kullanmak, siz " +"veya kurs katılımcılarının tespit ettiği yazım hatalarını düzeltmenize de " +"olanak tanır." -#: src/running-the-course.md:35 +#: src/running-the-course.md:43 msgid "" "Let people solve the exercises by themselves or in small groups. We " "typically spend 30-45 minutes on exercises in the morning and in the " @@ -1207,14 +1295,23 @@ msgid "" "offer a solution, e.g., by showing people where to find the relevant " "information in the standard library." msgstr "" +"İnsanların alıştırmaları kendi başlarına veya küçük gruplar halinde " +"çözmelerine izin verin. Genellikle sabah ve öğleden sonra egzersizlere 30-45 " +"dakika harcıyoruz (çözümleri gözden geçirme (review) zamanı da dahil). " +"İnsanlara takılıp kalmadıklarını veya yardımcı olabileceğiniz bir konu olup " +"olmadığını sorduğunuzdan emin olun. Birkaç kişinin aynı sorunu yaşadığını " +"gördüğünüzde bunu sınıfa söyleyin ve bir çözüm önerin; örneğin insanlara " +"standart kütüphanede ilgili bilgiyi nerede bulabileceklerini gösterin." -#: 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!" msgstr "" +"Hepsi bu kadar, kursta iyi şanslar! Umarız bizim için olduğu kadar sizin " +"için de eğlenceli olur!" -#: 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 " @@ -1222,48 +1319,69 @@ msgid "" "Your students are also very welcome to [send us feedback](https://github.com/" "google/comprehensive-rust/discussions/100)!" msgstr "" +"Kursu geliştirmeye devam edebilmemiz için lütfen sonrasında [geri bildirimde " +"bulunun](https://github.com/google/comprehensive-rust/discussions/86). Sizin " +"için neyin işe yaradığını ve neyin daha iyi hale getirilebileceğini duymak " +"isteriz. Öğrencileriniz de [bize geri bildirim gönderebilir](https://github." +"com/google/comprehensive-rust/discussions/100)!" #: src/running-the-course/course-structure.md:5 -msgid "The course is fast paced and covers a lot of ground:" -msgstr "" +msgid "Rust Fundamentals" +msgstr "Rust Esasları" #: src/running-the-course/course-structure.md:7 +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 "" +"İlk üç gün [Rust Temelleri](../welcome-day-1.md)'ni oluşturur. Günler hızlı " +"geçiyor ve çok fazla yol kat ediyoruz:" + +#: src/running-the-course/course-structure.md:10 msgid "Day 1: Basic Rust, syntax, control flow, creating and consuming values." msgstr "" +"1. Gün: Temel Rust, sözdizimi, kontrol akışı, değer oluşturma ve tüketme." -#: src/running-the-course/course-structure.md:8 +#: src/running-the-course/course-structure.md:11 msgid "" "Day 2: Memory management, ownership, compound data types, and the standard " "library." msgstr "" +"2. Gün: Bellek yönetimi, sahiplik, bileşik veri türleri ve standart kitaplık." -#: src/running-the-course/course-structure.md:9 +#: src/running-the-course/course-structure.md:12 msgid "Day 3: Generics, traits, error handling, testing, and unsafe Rust." msgstr "" +"3. Gün: Jenerikler, özellikler (traits), hata işleme, testler ve güvenli " +"olmayan (unsafe) Rust." -#: src/running-the-course/course-structure.md:11 +#: src/running-the-course/course-structure.md:14 msgid "Deep Dives" -msgstr "" +msgstr "Derin Dalışlar" -#: 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 "" +"Rust'ın Esasları hakkındaki 3 günlük derse ek olarak, daha özel konuları da " +"ele alıyoruz:" -#: src/running-the-course/course-structure.md:16 -#, fuzzy +#: src/running-the-course/course-structure.md:19 msgid "Rust in Android" -msgstr "Android" +msgstr "Android'de Rust" -#: src/running-the-course/course-structure.md:18 +#: src/running-the-course/course-structure.md:21 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 "" +"[Rust in Android](../android.md) ayrıntılı incelemesi, Android platformu " +"geliştirme için Rust'ı kullanma konusunda yarım günlük bir kurstur. Buna C, " +"C++ ve Java ile birlikte çalışabilirlik (interoperability) de dahildir." -#: src/running-the-course/course-structure.md:22 +#: src/running-the-course/course-structure.md:25 msgid "" "You will need an [AOSP checkout](https://source.android.com/docs/setup/" "download/downloading). Make a checkout of the [course repository](https://" @@ -1271,175 +1389,250 @@ msgid "" "android/` directory into the root of your AOSP checkout. This will ensure " "that the Android build system sees the `Android.bp` files in `src/android/`." msgstr "" +"Bir [AOSP kasasına](https://source.android.com/docs/setup/download/" +"downloading) ihtiyacınız olacak. Aynı makinede [kurs deposunu](https://" +"github.com/google/comprehensive-rust) kontrol edin ve `src/android/` " +"dizinini AOSP kasasının kök dizinine taşıyın. Bu, Android inşa (build) " +"sisteminin `src/android/` içindeki `Android.bp` dosyalarını görmesini " +"sağlayacaktır." -#: src/running-the-course/course-structure.md:27 +#: src/running-the-course/course-structure.md:30 msgid "" "Ensure that `adb sync` works with your emulator or real device and pre-build " "all Android examples using `src/android/build_all.sh`. Read the script to " "see the commands it runs and make sure they work when you run them by hand." msgstr "" +"`adb sync` emülatörünüzle veya gerçek cihazınızla çalıştığından emin olun ve " +"tüm Android örneklerini `src/android/build_all.sh` kullanarak önceden inşa " +"(build) edin. Çalıştırdığı komutları görmek için betiği okuyun ve bunları " +"elle çalıştırdığınızda çalıştıklarından emin olun." -#: src/running-the-course/course-structure.md:34 +#: src/running-the-course/course-structure.md:37 msgid "Bare-Metal Rust" -msgstr "" +msgstr "Yalın-Metal (Bare-metal) Rust" -#: src/running-the-course/course-structure.md:36 +#: src/running-the-course/course-structure.md:39 msgid "" "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 "" +"[Yalın-Metal Rust](../bare-metal.md) ayrıntılı incelemesi, yalın metal " +"(gömülü) geliştirme için Rust kullanımına ilişkin tam günlük bir derstir. " +"Hem mikrodenetleyiciler hem de uygulama işlemcileri kapsanmaktadır." -#: 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 " "need to install a number of packages as described on the [welcome page](../" "bare-metal.md)." msgstr "" +"Mikrodenetleyici kısmı için [BBC micro:bit](https://microbit.org/) v2 " +"geliştirme kartını önceden satın almanız gerekecek. Herkesin [karşılama " +"sayfasında](../bare-metal.md) açıklandığı gibi bir dizi paketi yüklemesi " +"gerekecektir." -#: src/running-the-course/course-structure.md:45 +#: src/running-the-course/course-structure.md:48 msgid "Concurrency in Rust" -msgstr "" +msgstr "Rust'ta Eşzamanlılık" -#: src/running-the-course/course-structure.md:47 +#: 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 "" +"[Rust'ta Eşzamanlılık](../concurrency.md) ayrıntılı incelemesi, klasik ve " +"aynı zamanda `async`/`await` eşzamanlılığı üzerine tam günlük bir derstir." -#: src/running-the-course/course-structure.md:50 +#: 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 "" +"Yeni bir sandık kurulumuna ve bağımlılıkların indirilip kullanıma hazır hale " +"getirilmesine ihtiyacınız olacak. Daha sonra örnekleri denemek için " +"kopyalayıp `src/main.rs` dosyasına yapıştırabilirsiniz:" -#: src/running-the-course/course-structure.md:54 -msgid "" -"```shell\n" -"cargo init concurrency\n" -"cd concurrency\n" -"cargo add tokio --features full\n" -"cargo run\n" -"```" -msgstr "" - -#: src/running-the-course/course-structure.md:61 +#: src/running-the-course/course-structure.md:64 msgid "Format" -msgstr "" +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!" msgstr "" +"Kursun çok etkileşimli olması amaçlanıyor ve soruların Rust'ın keşfini " +"yönlendirmesine izin vermenizi öneririz!" #: src/running-the-course/keyboard-shortcuts.md:3 msgid "There are several useful keyboard shortcuts in mdBook:" -msgstr "" +msgstr "mdBook'ta birkaç kullanışlı klavye kısayolu vardır:" #: src/running-the-course/keyboard-shortcuts.md:5 msgid "Arrow-Left" -msgstr "" +msgstr "Yön Oku-Sol" #: src/running-the-course/keyboard-shortcuts.md:5 msgid ": Navigate to the previous page." -msgstr "" +msgstr ": Önceki sayfaya gidin." #: src/running-the-course/keyboard-shortcuts.md:6 msgid "Arrow-Right" -msgstr "" +msgstr "Yön Oku-Sağ" #: src/running-the-course/keyboard-shortcuts.md:6 msgid ": Navigate to the next page." -msgstr "" +msgstr ": Sonraki sayfaya gidin." #: src/running-the-course/keyboard-shortcuts.md:7 src/cargo/code-samples.md:19 msgid "Ctrl + Enter" -msgstr "" +msgstr "Ctrl + Enter" #: src/running-the-course/keyboard-shortcuts.md:7 msgid ": Execute the code sample that has focus." -msgstr "" +msgstr ": Odaklı kod örneğini yürütün." #: src/running-the-course/keyboard-shortcuts.md:8 msgid "s" -msgstr "" +msgstr "s" #: src/running-the-course/keyboard-shortcuts.md:8 msgid ": Activate the search bar." -msgstr "" +msgstr ": Arama çubuğunu etkinleştirin." #: src/running-the-course/translations.md:3 msgid "" "The course has been translated into other languages by a set of wonderful " "volunteers:" -msgstr "" +msgstr "Kurs bir grup harika gönüllüler tarafından diğer dillere çevrildi:" #: src/running-the-course/translations.md:6 msgid "" "[Brazilian Portuguese](https://google.github.io/comprehensive-rust/pt-BR/) " "by [@rastringer](https://github.com/rastringer), [@hugojacob](https://github." -"com/hugojacob), [@joaovicmendes](https://github.com/joaovicmendes) and " +"com/hugojacob), [@joaovicmendes](https://github.com/joaovicmendes), and " "[@henrif75](https://github.com/henrif75)." msgstr "" +"[Brezilya Portekizcesi](https://google.github.io/comprehensive-rust/pt-BR/) " +"yazanlar: [@rastringer](https://github.com/rastringer), [@hugojacob](https://" +"github.com/hugojacob), [@joaovicmendes](https://github.com/joaovicmendes) ve " +"[@henrif75](https://github.com/henrif75)." #: src/running-the-course/translations.md:7 msgid "" -"[Korean](https://google.github.io/comprehensive-rust/ko/) by [@keispace]" -"(https://github.com/keispace), [@jiyongp](https://github.com/jiyongp) and " -"[@jooyunghan](https://github.com/jooyunghan)." +"[Chinese (Simplified)](https://google.github.io/comprehensive-rust/zh-CN/) " +"by [@suetfei](https://github.com/suetfei), [@wnghl](https://github.com/" +"wnghl), [@anlunx](https://github.com/anlunx), [@kongy](https://github.com/" +"kongy), [@noahdragon](https://github.com/noahdragon), [@superwhd](https://" +"github.com/superwhd), [@SketchK](https://github.com/SketchK), and [@nodmp]" +"(https://github.com/nodmp)." msgstr "" +"[Çince (Basitleştirilmiş)](https://google.github.io/comprehensive-rust/zh-" +"CN/) yazanlar: [@suetfei](https://github.com/suetfei), [@wnghl](https://" +"github.com/wnghl), [@anlunx](https://github.com/anlunx), [@kongy](https://" +"github.com/kongy), [@noahdragon](https://github.com/noahdragon), [@superwhd]" +"(https://github.com/superwhd), [@SketchK](https://github.com/SketchK) ve " +"[@nodmp](https://github.com/nodmp)." + +#: src/running-the-course/translations.md:8 +msgid "" +"[Chinese (Traditional)](https://google.github.io/comprehensive-rust/zh-TW/) " +"by [@hueich](https://github.com/hueich), [@victorhsieh](https://github.com/" +"victorhsieh), [@mingyc](https://github.com/mingyc), [@kuanhungchen](https://" +"github.com/kuanhungchen), and [@johnathan79717](https://github.com/" +"johnathan79717)." +msgstr "" +"[Çince (Geleneksel)](https://google.github.io/comprehensive-rust/zh-TW/) " +"yazanlar: [@hueich](https://github.com/hueich), [@victorhsieh](https://" +"github.com/victorhsieh), [@mingyc](https://github.com/mingyc), " +"[@kuanhungchen](https://github.com/kuanhungchen) ve [@johnathan79717]" +"(https://github.com/johnathan79717)." #: src/running-the-course/translations.md:9 msgid "" +"[Korean](https://google.github.io/comprehensive-rust/ko/) by [@keispace]" +"(https://github.com/keispace), [@jiyongp](https://github.com/jiyongp), and " +"[@jooyunghan](https://github.com/jooyunghan)." +msgstr "" +"[Korece](https://google.github.io/comprehensive-rust/ko/) yazanlar: " +"[@keispace](https://github.com/keispace), [@jiyongp](https://github.com) /" +"jiyongp) ve [@jooyunghan](https://github.com/jooyunghan)." + +#: src/running-the-course/translations.md:10 +msgid "" +"[Spanish](https://google.github.io/comprehensive-rust/es/) by [@deavid]" +"(https://github.com/deavid)." +msgstr "" +"[Bengalce](https://google.github.io/comprehensive-rust/bn/) yazanlar: " +"[@raselmandol](https://github.com/raselmandol)." + +#: src/running-the-course/translations.md:12 +msgid "" "Use the language picker in the top-right corner to switch between languages." msgstr "" +"Diller arasında geçiş yapmak için sağ üst köşedeki dil seçiciyi kullanın." -#: src/running-the-course/translations.md:11 -#, fuzzy +#: src/running-the-course/translations.md:14 msgid "Incomplete Translations" -msgstr "Çeviriler" +msgstr "Tamamlanmamış Çeviriler" -#: src/running-the-course/translations.md:13 +#: src/running-the-course/translations.md:16 msgid "" "There is a large number of in-progress translations. We link to the most " "recently updated translations:" msgstr "" +"Devam eden çok sayıda çeviri var. En son güncellenen çevirilere bağlantı " +"veriyoruz:" -#: src/running-the-course/translations.md:16 +#: src/running-the-course/translations.md:19 msgid "" "[Bengali](https://google.github.io/comprehensive-rust/bn/) by [@raselmandol]" "(https://github.com/raselmandol)." msgstr "" +"[Bengalce](https://google.github.io/comprehensive-rust/bn/) yazanlar: " +"[@raselmandol](https://github.com/raselmandol)." -#: src/running-the-course/translations.md:17 +#: src/running-the-course/translations.md:20 msgid "" "[French](https://google.github.io/comprehensive-rust/fr/) by [@KookaS]" "(https://github.com/KookaS) and [@vcaen](https://github.com/vcaen)." msgstr "" +"[Fransızca](https://google.github.io/comprehensive-rust/fr/) yazanlar: " +"[@KookaS](https://github.com/KookaS) ve [@vcaen](https://github.com) /vcaen)." -#: src/running-the-course/translations.md:18 +#: src/running-the-course/translations.md:21 msgid "" "[German](https://google.github.io/comprehensive-rust/de/) by [@Throvn]" "(https://github.com/Throvn) and [@ronaldfw](https://github.com/ronaldfw)." msgstr "" +"[Almanca](https://google.github.io/comprehensive-rust/de/) yazanlar: " +"[@Throvn](https://github.com/Throvn) ve [@ronaldfw](https://github.com) /" +"ronaldfw)." -#: src/running-the-course/translations.md:19 +#: src/running-the-course/translations.md:22 msgid "" "[Japanese](https://google.github.io/comprehensive-rust/ja/) by [@CoinEZ-JPN]" "(https://github.com/CoinEZ) and [@momotaro1105](https://github.com/" "momotaro1105)." msgstr "" +"[Japonca](https://google.github.io/comprehensive-rust/ja/) yazanlar: " +"[@CoinEZ-JPN](https://github.com/CoinEZ) ve [@momotaro1105](https://github) ." +"com/momotaro1105)." -#: src/running-the-course/translations.md:21 +#: src/running-the-course/translations.md:24 msgid "" "If you want to help with this effort, please see [our instructions](https://" "github.com/google/comprehensive-rust/blob/main/TRANSLATIONS.md) for how to " "get going. Translations are coordinated on the [issue tracker](https://" "github.com/google/comprehensive-rust/issues/282)." msgstr "" +"Bu çabaya yardımcı olmak istiyorsanız nasıl başlayacağınızı öğrenmek için " +"lütfen [talimatlarımıza](https://github.com/google/comprehensive-rust/blob/" +"main/TRANSLATIONS.md) bakın. Çeviriler [sorun izleyicide](https://github.com/" +"google/comprehensive-rust/issues/282) üzerinde koordine edilir." #: src/cargo.md:3 msgid "" @@ -1449,67 +1642,79 @@ msgid "" "Cargo is and how it fits into the wider ecosystem and how it fits into this " "training." msgstr "" +"Rust hakkında okumaya başladığınızda, Rust ekosisteminde Rust uygulamalarını " +"inşa etmek (build) ve çalıştırmak için kullanılan standart araç [Cargo]" +"(https://doc.rust-lang.org/cargo/) ile yakında tanışacaksınız. Burada " +"Cargo'nun ne olduğuna, daha geniş ekosisteme nasıl uyum sağladığına ve bu " +"eğitime nasıl uyduğuna dair kısa bir genel bakış sunmak istiyoruz." #: src/cargo.md:8 msgid "Installation" -msgstr "" +msgstr "Kurulum" #: src/cargo.md:10 msgid "**Please follow the instructions on .**" -msgstr "" +msgstr "**Lütfen adresindeki talimatları izleyin.**" #: src/cargo.md:12 msgid "" "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." +"use to install to different compiler versions." msgstr "" +"Bu size Cargo oluşturma aracını (`cargo`) ve Rust derleyicisini (`rustc`) " +"sağlayacaktır. Ayrıca, araç zincirlerini (toolchain) kurmak/değiştirmek, " +"çapraz derlemeyi ayarlamak vb. için kullanabileceğiniz bir komut satırı " +"yardımcı programı olan `rustup` a sahip olacaksınız." -#: src/cargo.md:16 +#: src/cargo.md:14 +msgid "" +"After installing Rust, you should configure your editor or IDE to work with " +"Rust. Most editors do this by talking to [rust-analyzer](https://rust-" +"analyzer.github.io/), which provides auto-completion and jump-to-definition " +"functionality for [VS Code](https://code.visualstudio.com/), [Emacs](https://" +"rust-analyzer.github.io/manual.html#emacs), [Vim/Neovim](https://rust-" +"analyzer.github.io/manual.html#vimneovim), and many others. There is also a " +"different IDE available called [RustRover](https://www.jetbrains.com/rust/)." +msgstr "" +"Rust'u kurduktan sonra editörünüzü/düzenleyicinizi veya IDE'nizi Rust ile " +"çalışacak şekilde yapılandırmalısınız. Çoğu editör bunu, [VS Code](https://" +"code.visualstudio.com/), [Emacs](https://rust-analyzer.github.io/manual." +"html#emacs), [Vim/Neovim](https://rust-analyzer.github.io/manual. " +"html#vimneovim) ve diğerleri için otomatik tamamlama ve tanıma atlama işlevi " +"sağlayan [rust-analyzer](https://rust-analyzer.github.io/) ile haberleşerek " +"yapar. Ayrıca [RustRover](https://www.jetbrains.com/rust/) adında farklı bir " +"IDE de mevcuttur." + +#: src/cargo.md:18 msgid "" "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 "" - -#: src/cargo.md:18 -msgid "" -"```shell\n" -"sudo apt install cargo rust-src rustfmt\n" -"```" -msgstr "" - -#: src/cargo.md:22 -msgid "" -"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 "" - -#: 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 " -"tradeoffs. If you prefer them, you can install the [Rust Plugin](https://www." -"jetbrains.com/rust/). Please take note that as of January 2023 debugging " -"only works on the CLion version of the JetBrains IDEA suite." -msgstr "" +"Debian/Ubuntu'da ayrıca Cargo'yu, Rust kaynak kodunu ve [Rust formatlayıcıyı]" +"(https://github.com/rust-lang/rustfmt) `apt` aracılığıyla yükleyebilirsiniz. " +"Ancak bu, eski bir Rust sürümüne sahip olmanızı sağlar ve beklenmeyen " +"davranışlara yol açabilir. Komut şöyle olacaktır:" #: src/cargo/rust-ecosystem.md:1 msgid "The Rust Ecosystem" -msgstr "" +msgstr "Rust Ekosistemi" #: src/cargo/rust-ecosystem.md:3 msgid "" "The Rust ecosystem consists of a number of tools, of which the main ones are:" msgstr "" +"Rust ekosistemi bir dizi araçtan oluşur; bunların başlıcaları şunlardır:" #: src/cargo/rust-ecosystem.md:5 msgid "" "`rustc`: the Rust compiler which turns `.rs` files into binaries and other " "intermediate formats." msgstr "" +"`rustc`: `.rs` dosyalarını ikili (binary) dosyalara ve diğer ara formatlara " +"dönüştüren Rust derleyicisi." #: src/cargo/rust-ecosystem.md:8 msgid "" @@ -1518,6 +1723,11 @@ msgid "" "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`: Rust bağımlılık yöneticisi ve inşa (build) aracı. Cargo, genellikle " +" üzerinde barındırılan bağımlılıkları nasıl indireceğini " +"bilir ve projenizi oluştururken bunları `rustc` derleyicisine aktarır. Cargo " +"ayrıca birim testlerini yürütmek için kullanılan yerleşik bir test " +"çalıştırıcısıyla birlikte gelir." #: src/cargo/rust-ecosystem.md:13 msgid "" @@ -1527,17 +1737,24 @@ msgid "" "standard library. You can have multiple versions of Rust installed at once " "and `rustup` will let you switch between them as needed." msgstr "" +"`rustup`: Rust araç zinciri (toolchain) yükleyicisi ve güncelleyicisi. Bu " +"araç, Rust'un yeni sürümleri yayınlandığında `rustc` ve `cargo` " +"programlarını yüklemek ve güncellemek için kullanılır. Ek olarak, `rustup` " +"standart kütüphanenin belgelerini de indirebilir. Aynı anda birden fazla " +"Rust sürümünü yükleyebilirsiniz ve `rustup` gerektiğinde bunlar arasında " +"geçiş yapmanıza olanak tanır." #: src/cargo/rust-ecosystem.md:21 src/hello-world.md:25 #: src/hello-world/small-example.md:27 src/why-rust/runtime.md:10 -#: src/why-rust/modern.md:21 src/basic-syntax/compound-types.md:30 -#: src/basic-syntax/references.md:23 +#: src/why-rust/modern.md:21 src/basic-syntax/compound-types.md:32 +#: src/basic-syntax/references.md:24 #: src/pattern-matching/destructuring-enums.md:35 +#: src/ownership/double-free-modern-cpp.md:55 #: src/error-handling/try-operator.md:48 #: src/error-handling/converting-error-types-example.md:50 #: src/concurrency/threads.md:30 src/async/async-await.md:25 msgid "Key points:" -msgstr "" +msgstr "Anahtar noktalar:" #: src/cargo/rust-ecosystem.md:23 msgid "" @@ -1545,53 +1762,74 @@ msgid "" "weeks. New releases maintain backwards compatibility with old releases --- " "plus they enable new functionality." msgstr "" +"Rust'un her altı haftada bir yeni sürümünün çıktığı hızlı bir sürüm programı " +"var. Yeni sürümler, eski sürümlerle geriye dönük uyumluluğu korur ve ayrıca " +"yeni işlevsellik sağlar." #: src/cargo/rust-ecosystem.md:27 msgid "" "There are three release channels: \"stable\", \"beta\", and \"nightly\"." msgstr "" +"Üç sürüm kanalı vardır: \"kararlı (stable)\", \"beta\" ve \"gecelik " +"(nightly)\"." #: src/cargo/rust-ecosystem.md:29 msgid "" "New features are being tested on \"nightly\", \"beta\" is what becomes " "\"stable\" every six weeks." msgstr "" +"Yeni özellikler \"gecelik (nightly)\" kanalında test ediliyor, \"beta\" her " +"altı haftada bir \"kararlı (stable)\" hale geliyor." #: src/cargo/rust-ecosystem.md:32 msgid "" "Dependencies can also be resolved from alternative [registries](https://doc." "rust-lang.org/cargo/reference/registries.html), git, folders, and more." msgstr "" +"Bağımlılıklar ayrıca alternatif olarak [kayıtlardan](https://doc.rust-lang." +"org/cargo/reference/registries.html), git'ten, klasörlerden ve daha " +"fazlasından çözülebilir." #: src/cargo/rust-ecosystem.md:34 msgid "" "Rust also has [editions](https://doc.rust-lang.org/edition-guide/): the " "current edition is Rust 2021. Previous editions were Rust 2015 and Rust 2018." msgstr "" +"Rust'ın ayrıca [yayınları](https://doc.rust-lang.org/edition-guide/) " +"(editions) vardır: mevcut yayın (edition) Rust 2021'dir. Önceki yayınlar " +"Rust 2015 ve Rust 2018'di." #: src/cargo/rust-ecosystem.md:37 msgid "" "The editions are allowed to make backwards incompatible changes to the " "language." msgstr "" +"Yayınların dilde geriye dönük olarak uyumsuz değişiklikler yapmasına izin " +"verilir." #: src/cargo/rust-ecosystem.md:40 msgid "" "To prevent breaking code, editions are opt-in: you select the edition for " "your crate via the `Cargo.toml` file." msgstr "" +"Kodun kırılmasını (breaking code) önlemek için yayınlar isteğe bağlıdır: " +"`Cargo.toml` dosyası aracılığıyla kasanızın (crate) sürümünü seçersiniz." #: src/cargo/rust-ecosystem.md:43 msgid "" "To avoid splitting the ecosystem, Rust compilers can mix code written for " "different editions." msgstr "" +"Ekosistemin bölünmesini önlemek için Rust derleyicileri farklı sürümler için " +"yazılan kodları karıştırabilir." #: src/cargo/rust-ecosystem.md:46 msgid "" "Mention that it is quite rare to ever use the compiler directly not through " "`cargo` (most users never do)." msgstr "" +"Derleyiciyi `cargo` yoluyla değil de doğrudan kullanmanın oldukça nadir " +"olduğunu unutmayın (çoğu kullanıcı asla kullanmaz)." #: src/cargo/rust-ecosystem.md:48 msgid "" @@ -1599,45 +1837,58 @@ msgid "" "comprehensive tool. It is capable of many advanced features including but " "not limited to: " msgstr "" +"Cargo'nun kendisinin son derece güçlü ve kapsamlı bir araç olduğunu " +"belirtmekte fayda var. Aşağıdakiler dahil olmakla ve bunlarla sınırlı " +"olmamak üzere birçok gelişmiş özelliğe sahiptir: " #: src/cargo/rust-ecosystem.md:49 msgid "Project/package structure" -msgstr "" +msgstr "Proje/paket yapısı" #: src/cargo/rust-ecosystem.md:50 msgid "[workspaces](https://doc.rust-lang.org/cargo/reference/workspaces.html)" msgstr "" +"[çalışma alanları](https://doc.rust-lang.org/cargo/reference/workspaces.html)" #: src/cargo/rust-ecosystem.md:51 msgid "Dev Dependencies and Runtime Dependency management/caching" msgstr "" +"Geliştirici Bağımlılıkları ve Çalışma Zamanı Bağımlılığı yönetimi/önbelleğe " +"alma" #: src/cargo/rust-ecosystem.md:52 msgid "" "[build scripting](https://doc.rust-lang.org/cargo/reference/build-scripts." "html)" msgstr "" +"[build scripting](https://doc.rust-lang.org/cargo/reference/build-scripts." +"html)" #: src/cargo/rust-ecosystem.md:53 msgid "" "[global installation](https://doc.rust-lang.org/cargo/commands/cargo-install." "html)" msgstr "" +"[genel kurulum](https://doc.rust-lang.org/cargo/commands/cargo-install.html)" #: src/cargo/rust-ecosystem.md:54 msgid "" "It is also extensible with sub command plugins as well (such as [cargo " "clippy](https://github.com/rust-lang/rust-clippy))." msgstr "" +"Ayrıca alt komut eklentileriyle de genişletilebilir ([cargo Clippy](https://" +"github.com/rust-lang/rust-clippy) gibi)." #: src/cargo/rust-ecosystem.md:55 msgid "" "Read more from the [official Cargo Book](https://doc.rust-lang.org/cargo/)" msgstr "" +"[Resmi Cargo Kitabı'ndan](https://doc.rust-lang.org/cargo/) daha fazlasını " +"okuyun" #: src/cargo/code-samples.md:1 msgid "Code Samples in This Training" -msgstr "" +msgstr "Bu Eğitimdeki Kod Örnekleri" #: src/cargo/code-samples.md:3 msgid "" @@ -1645,6 +1896,9 @@ msgid "" "which can be executed through your browser. This makes the setup much easier " "and ensures a consistent experience for everyone." msgstr "" +"Bu eğitimde çoğunlukla Rust dilini tarayıcınız üzerinden " +"çalıştırabileceğiniz örnekler üzerinden inceleyeceğiz. Bu, kurulumu çok daha " +"kolay hale getirir ve herkes için tutarlı bir deneyim sağlar." #: src/cargo/code-samples.md:7 msgid "" @@ -1652,10 +1906,14 @@ msgid "" "the exercises. On the last day, we will do a larger exercise which shows you " "how to work with dependencies and for that you need Cargo." msgstr "" +"Cargo'nun kurulumu hala teşvik edilmektedir: egzersizleri yapmanızı " +"kolaylaştıracaktır. Son gün, bağımlılıklarla nasıl çalışacağınızı ve bunun " +"için Cargo'ya ihtiyacınız olduğunu gösteren daha büyük bir alıştırma " +"yapacağız." #: src/cargo/code-samples.md:11 msgid "The code blocks in this course are fully interactive:" -msgstr "" +msgstr "Bu kurstaki kod blokları tamamen etkileşimlidir:" #: src/cargo/code-samples.md:13 msgid "" @@ -1665,26 +1923,36 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" println!(\"Edit me!\");\n" +"}\n" +"```" #: src/cargo/code-samples.md:19 msgid "You can use " -msgstr "" +msgstr "Odak metin kutusundayken kodu yürütmek için " #: src/cargo/code-samples.md:19 msgid " to execute the code when focus is in the text box." -msgstr "" +msgstr " kullanabilirsiniz.." #: src/cargo/code-samples.md:24 msgid "" "Most code samples are editable like shown above. A few code samples are not " "editable for various reasons:" msgstr "" +"Çoğu kod örneği yukarıda gösterildiği gibi düzenlenebilir. Birkaç kod örneği " +"çeşitli nedenlerden dolayı düzenlenemez:" #: src/cargo/code-samples.md:27 msgid "" "The embedded playgrounds cannot execute unit tests. Copy-paste the code and " "open it in the real Playground to demonstrate unit tests." msgstr "" +"Gömülü deneme alanları (playgrounds) birim testleri gerçekleştiremez. Birim " +"testlerini göstermek için kodu kopyalayıp yapıştırın ve gerçek Deneme " +"Alanında (Playground) açın." #: src/cargo/code-samples.md:30 msgid "" @@ -1692,10 +1960,13 @@ msgid "" "the page! This is the reason that the students should solve the exercises " "using a local Rust installation or via the Playground." msgstr "" +"Gömülü deneme alanları, sayfadan uzaklaştığınız anda durumlarını kaybeder! " +"Öğrencilerin alıştırmaları yerel bir Rust kurulumu kullanarak veya Deneme " +"Alanı aracılığıyla çözmelerinin nedeni budur." #: src/cargo/running-locally.md:1 msgid "Running Code Locally with Cargo" -msgstr "" +msgstr "Cargo'nun Yerel (Local) Olarak Çalıştırılması" #: src/cargo/running-locally.md:3 msgid "" @@ -1705,68 +1976,56 @@ msgid "" "should give you a working `rustc` and `cargo`. At the time of writing, the " "latest stable Rust release has these version numbers:" msgstr "" - -#: src/cargo/running-locally.md:8 -msgid "" -"```shell\n" -"% rustc --version\n" -"rustc 1.69.0 (84c898d65 2023-04-16)\n" -"% cargo --version\n" -"cargo 1.69.0 (6e9a83356 2023-04-12)\n" -"```" -msgstr "" +"Kodu kendi sisteminizde denemek istiyorsanız, önce Rust'u yüklemeniz " +"gerekecektir. Bunu [Rust Book'taki talimatları](https://doc.rust-lang.org/" +"book/ch01-01-installation.html) uygulayarak yapın. Bu size çalışan bir " +"`rustc` ve `cargo`vermelidir. Bu yazının yazıldığı sırada en son kararlı " +"Rust sürümü şu sürüm numaralarına sahiptir:" #: src/cargo/running-locally.md:15 msgid "" "You can use any later version too since Rust maintains backwards " "compatibility." msgstr "" +"Rust geriye dönük uyumluluğu koruduğu için daha sonraki herhangi bir sürümü " +"de kullanabilirsiniz." #: src/cargo/running-locally.md:17 msgid "" "With this in place, follow these steps to build a Rust binary from one of " "the examples in this training:" msgstr "" +"Bunu yaptıktan sonra, bu eğitimdeki örneklerden birinden bir Rust ikili " +"(binary) programı oluşturmak için şu adımları izleyin:" #: src/cargo/running-locally.md:20 msgid "Click the \"Copy to clipboard\" button on the example you want to copy." msgstr "" +"Kopyalamak istediğiniz örneğin üzerindeki \"Panoya kopyala\" düğmesine " +"tıklayın." #: src/cargo/running-locally.md:22 msgid "" "Use `cargo new exercise` to create a new `exercise/` directory for your code:" msgstr "" - -#: src/cargo/running-locally.md:24 -msgid "" -"```shell\n" -"$ cargo new exercise\n" -" Created binary (application) `exercise` package\n" -"```" -msgstr "" +"Kodunuz için yeni bir `exercise/` dizini oluşturmak için `cargo new " +"exercise` komutunu kullanın:" #: src/cargo/running-locally.md:29 msgid "" "Navigate into `exercise/` and use `cargo run` to build and run your binary:" msgstr "" - -#: src/cargo/running-locally.md:31 -msgid "" -"```shell\n" -"$ cd exercise\n" -"$ cargo run\n" -" Compiling exercise v0.1.0 (/home/mgeisler/tmp/exercise)\n" -" Finished dev [unoptimized + debuginfo] target(s) in 0.75s\n" -" Running `target/debug/exercise`\n" -"Hello, world!\n" -"```" -msgstr "" +"İkili (binary) dosyanızı inşa etmek (build) ve çalıştırmak için `exercise/` " +"dizinine gidin ve `cargo run` komutunu kullanın:" #: src/cargo/running-locally.md:40 msgid "" "Replace the boiler-plate code in `src/main.rs` with your own code. For " "example, using the example on the previous page, make `src/main.rs` look like" msgstr "" +"`src/main.rs` dosyasındaki hazır kodu kendi kodunuzla değiştirin. Örneğin, " +"önceki sayfadaki örneği kullanarak `src/main.rs` dosyasının şu şekilde " +"görünmesini sağlayın" #: src/cargo/running-locally.md:43 msgid "" @@ -1776,21 +2035,17 @@ msgid "" "}\n" "```" msgstr "" +"```rust\n" +"fn main() {\n" +" println!(\"Edit me!\");\n" +"}\n" +"```" #: src/cargo/running-locally.md:49 msgid "Use `cargo run` to build and run your updated binary:" msgstr "" - -#: src/cargo/running-locally.md:51 -msgid "" -"```shell\n" -"$ cargo run\n" -" Compiling exercise v0.1.0 (/home/mgeisler/tmp/exercise)\n" -" Finished dev [unoptimized + debuginfo] target(s) in 0.24s\n" -" Running `target/debug/exercise`\n" -"Edit me!\n" -"```" -msgstr "" +"Güncellenmiş ikili (binary) dosyanızı inşa etmek (build) ve çalıştırmak " +"(run) için `cargo run` komutunu kullanın:" #: src/cargo/running-locally.md:59 msgid "" @@ -1799,6 +2054,11 @@ msgid "" "debug/` for a normal debug build. Use `cargo build --release` to produce an " "optimized release build in `target/release/`." msgstr "" +"Projenizi hatalara karşı hızlı bir şekilde kontrol etmek için `cargo check` " +"komutunu kullanın, çalıştırmadan derlemek için `cargo build` komutunu " +"kullanın. Normal bir hata ayıklama inşasında (build) çıktıyı `target/debug/` " +"içinde bulacaksınız. `target/release/` içinde optimize edilmiş bir sürüm " +"inşası oluşturmak için `cargo build --release` komutunu kullanın." #: src/cargo/running-locally.md:64 msgid "" @@ -1806,6 +2066,9 @@ msgid "" "run `cargo` commands, it will automatically download and compile missing " "dependencies for you." msgstr "" +"`Cargo.toml` dosyasını düzenleyerek projeniz için bağımlılıklar " +"ekleyebilirsiniz. `cargo` komutlarını çalıştırdığınızda, eksik " +"bağımlılıkları sizin için otomatik olarak indirip derleyecektir." #: src/cargo/running-locally.md:72 msgid "" @@ -1813,6 +2076,9 @@ msgid "" "editor. It will make their life easier since they will have a normal " "development environment." msgstr "" +"Sınıf katılımcılarını Cargo'yu yüklemeye ve yerel bir metin düzenleyici " +"kullanmaya teşvik etmeye çalışın. Normal bir gelişim ortamına sahip " +"olacakları için hayatları kolaylaşacaktır." #: src/welcome-day-1.md:1 msgid "Welcome to Day 1" @@ -2162,6 +2428,196 @@ msgid "" "collector) as well as access to low-level hardware (should you need it)" msgstr "" +#: src/why-rust/an-example-in-c.md:4 +msgid "Let's consider the following \"minimum wrong example\" program in C:" +msgstr "" + +#: src/why-rust/an-example-in-c.md:6 +msgid "" +"```c,editable\n" +"#include \n" +"#include \n" +"#include \n" +"\n" +"int main(int argc, char* argv[]) {\n" +"\tchar *buf, *filename;\n" +"\tFILE *fp;\n" +"\tsize_t bytes, len;\n" +"\tstruct stat st;\n" +"\n" +"\tswitch (argc) {\n" +"\t\tcase 1:\n" +"\t\t\tprintf(\"Too few arguments!\\n\");\n" +"\t\t\treturn 1;\n" +"\n" +"\t\tcase 2:\n" +"\t\t\tfilename = argv[argc];\n" +"\t\t\tstat(filename, &st);\n" +"\t\t\tlen = st.st_size;\n" +"\t\t\t\n" +"\t\t\tbuf = (char*)malloc(len);\n" +"\t\t\tif (!buf)\n" +"\t\t\t\tprintf(\"malloc failed!\\n\", len);\n" +"\t\t\t\treturn 1;\n" +"\n" +"\t\t\tfp = fopen(filename, \"rb\");\n" +"\t\t\tbytes = fread(buf, 1, len, fp);\n" +"\t\t\tif (bytes = st.st_size)\n" +"\t\t\t\tprintf(\"%s\", buf);\n" +"\t\t\telse\n" +"\t\t\t\tprintf(\"fread failed!\\n\");\n" +"\n" +"\t\tcase 3:\n" +"\t\t\tprintf(\"Too many arguments!\\n\");\n" +"\t\t\treturn 1;\n" +"\t}\n" +"\n" +"\treturn 0;\n" +"}\n" +"```" +msgstr "" + +#: src/why-rust/an-example-in-c.md:48 +msgid "How many bugs do you spot?" +msgstr "" + +#: src/why-rust/an-example-in-c.md:52 +msgid "" +"Despite just 29 lines of code, this C example contains serious bugs in at " +"least 11:" +msgstr "" + +#: src/why-rust/an-example-in-c.md:54 +msgid "Assignment `=` instead of equality comparison `==` (line 28)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:55 +msgid "Excess argument to `printf` (line 23)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:56 +msgid "File descriptor leak (after line 26)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:57 +msgid "Forgotten braces in multi-line `if` (line 22)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:58 +msgid "Forgotten `break` in a `switch` statement (line 32)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:59 +msgid "" +"Forgotten NUL-termination of the `buf` string, leading to a buffer overflow " +"(line 29)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:60 +msgid "Memory leak by not freeing the `malloc`\\-allocated buffer (line 21)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:61 +msgid "Out-of-bounds access (line 17)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:62 +msgid "Unchecked cases in the `switch` statement (line 11)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:63 +msgid "Unchecked return values of `stat` and `fopen` (lines 18 and 26)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:65 +msgid "" +"_Shouldn't these bugs be obvious even for a C compiler?_ \n" +"No, surprisingly this code compiles warning-free at the default warning " +"level, even in the latest GCC version (13.2 as of writing)." +msgstr "" + +#: src/why-rust/an-example-in-c.md:68 +msgid "" +"_Isn't this a highly unrealistic example?_ \n" +"Absolutely not, these kind of bugs have lead to serious security " +"vulnerabilities in the past. Some examples:" +msgstr "" + +#: src/why-rust/an-example-in-c.md:71 +msgid "" +"Assignment `=` instead of equality comparison `==`: [The Linux Backdoor " +"Attempt of 2003](https://freedom-to-tinker.com/2013/10/09/the-linux-backdoor-" +"attempt-of-2003)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:72 +msgid "" +"Forgotten braces in multi-line `if`: [The Apple goto fail vulnerability]" +"(https://dwheeler.com/essays/apple-goto-fail.html)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:73 +msgid "" +"Forgotten `break` in a `switch` statement: [The break that broke sudo]" +"(https://nakedsecurity.sophos.com/2012/05/21/anatomy-of-a-security-hole-the-" +"break-that-broke-sudo)" +msgstr "" + +#: src/why-rust/an-example-in-c.md:75 +msgid "" +"_How is Rust any better here?_ \n" +"Safe Rust makes all of these bugs impossible:" +msgstr "" + +#: src/why-rust/an-example-in-c.md:78 +msgid "Assignments inside an `if` clause are not supported." +msgstr "" + +#: src/why-rust/an-example-in-c.md:79 +msgid "Format strings are checked at compile-time." +msgstr "" + +#: src/why-rust/an-example-in-c.md:80 +msgid "Resources are freed at the end of scope via the `Drop` trait." +msgstr "" + +#: src/why-rust/an-example-in-c.md:81 +msgid "All `if` clauses require braces." +msgstr "" + +#: src/why-rust/an-example-in-c.md:82 +msgid "" +"`match` (as the Rust equivalent to `switch`) does not fall-through, hence " +"you can't accidentally forget a `break`." +msgstr "" + +#: src/why-rust/an-example-in-c.md:83 +msgid "Buffer slices carry their size and don't rely on a NUL terminator." +msgstr "" + +#: src/why-rust/an-example-in-c.md:84 +msgid "" +"Heap-allocated memory is freed via the `Drop` trait when the corresponding " +"`Box` leaves the scope." +msgstr "" + +#: src/why-rust/an-example-in-c.md:85 +msgid "" +"Out-of-bounds accesses cause a panic or can be checked via the `get` method " +"of a slice." +msgstr "" + +#: src/why-rust/an-example-in-c.md:86 +msgid "`match` mandates that all cases are handled." +msgstr "" + +#: src/why-rust/an-example-in-c.md:87 +msgid "" +"Fallible Rust functions return `Result` values that need to be unwrapped and " +"thereby checked for success. Additionally, the compiler emits a warning if " +"you miss to check the return value of a function marked with `#[must_use]`." +msgstr "" + #: src/why-rust/compile-time.md:3 msgid "Static memory management at compile time:" msgstr "" @@ -2513,31 +2969,11 @@ msgid "" "amount of `#` on either side of the quotes:" msgstr "" -#: src/basic-syntax/scalar-types.md:27 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" println!(r#\"link\"#);\n" -" println!(\"link\");\n" -"}\n" -"```" -msgstr "" - -#: src/basic-syntax/scalar-types.md:34 +#: src/basic-syntax/scalar-types.md:35 msgid "Byte strings allow you to create a `&[u8]` value directly:" msgstr "" -#: src/basic-syntax/scalar-types.md:36 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" println!(\"{:?}\", b\"abc\");\n" -" println!(\"{:?}\", &[97, 98, 99]);\n" -"}\n" -"```" -msgstr "" - -#: src/basic-syntax/scalar-types.md:43 +#: src/basic-syntax/scalar-types.md:45 msgid "" "All underscores in numbers can be left out, they are for legibility only. So " "`1_000` can be written as `1000` (or `10_00`), and `123_i64` can be written " @@ -2572,37 +3008,15 @@ msgstr "" msgid "Array assignment and access:" msgstr "" -#: src/basic-syntax/compound-types.md:10 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let mut a: [i8; 10] = [42; 10];\n" -" a[5] = 0;\n" -" println!(\"a: {:?}\", a);\n" -"}\n" -"```" -msgstr "" - -#: src/basic-syntax/compound-types.md:18 +#: src/basic-syntax/compound-types.md:19 msgid "Tuple assignment and access:" msgstr "" -#: src/basic-syntax/compound-types.md:20 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let t: (i8, bool) = (7, true);\n" -" println!(\"1st index: {}\", t.0);\n" -" println!(\"2nd index: {}\", t.1);\n" -"}\n" -"```" -msgstr "" - -#: src/basic-syntax/compound-types.md:32 +#: src/basic-syntax/compound-types.md:34 msgid "Arrays:" msgstr "" -#: src/basic-syntax/compound-types.md:34 +#: src/basic-syntax/compound-types.md:36 msgid "" "A value of the array type `[T; N]` holds `N` (a compile-time constant) " "elements of the same type `T`. Note that the length of the array is _part of " @@ -2610,43 +3024,44 @@ msgid "" "different types." msgstr "" -#: src/basic-syntax/compound-types.md:38 +#: src/basic-syntax/compound-types.md:40 msgid "We can use literals to assign values to arrays." msgstr "" -#: src/basic-syntax/compound-types.md:40 +#: src/basic-syntax/compound-types.md:42 msgid "" -"In the main function, the print statement asks for the debug implementation " -"with the `?` format parameter: `{}` gives the default output, `{:?}` gives " -"the debug output. We could also have used `{a}` and `{a:?}` without " -"specifying the value after the format string." +"The `println!` macro asks for the debug implementation with the `?` format " +"parameter: `{}` gives the default output, `{:?}` gives the debug output. " +"Types such as integers and strings implement the default output, but arrays " +"only implement the debug output. This means that we must use debug output " +"here." msgstr "" -#: src/basic-syntax/compound-types.md:45 +#: src/basic-syntax/compound-types.md:47 msgid "" "Adding `#`, eg `{a:#?}`, invokes a \"pretty printing\" format, which can be " "easier to read." msgstr "" -#: src/basic-syntax/compound-types.md:47 +#: src/basic-syntax/compound-types.md:49 msgid "Tuples:" msgstr "" -#: src/basic-syntax/compound-types.md:49 +#: src/basic-syntax/compound-types.md:51 msgid "Like arrays, tuples have a fixed length." msgstr "" -#: src/basic-syntax/compound-types.md:51 +#: src/basic-syntax/compound-types.md:53 msgid "Tuples group together values of different types into a compound type." msgstr "" -#: src/basic-syntax/compound-types.md:53 +#: src/basic-syntax/compound-types.md:55 msgid "" "Fields of a tuple can be accessed by the period and the index of the value, " "e.g. `t.0`, `t.1`." msgstr "" -#: src/basic-syntax/compound-types.md:55 +#: src/basic-syntax/compound-types.md:57 msgid "" "The empty tuple `()` is also known as the \"unit type\". It is both a type, " "and the only valid value of that type - that is to say both the type and its " @@ -2654,7 +3069,7 @@ msgid "" "function or expression has no return value, as we'll see in a future slide. " msgstr "" -#: src/basic-syntax/compound-types.md:59 +#: src/basic-syntax/compound-types.md:61 msgid "" "You can think of it as `void` that can be familiar to you from other " "programming languages." @@ -2664,41 +3079,29 @@ msgstr "" msgid "Like C++, Rust has references:" msgstr "" -#: src/basic-syntax/references.md:5 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let mut x: i32 = 10;\n" -" let ref_x: &mut i32 = &mut x;\n" -" *ref_x = 20;\n" -" println!(\"x: {x}\");\n" -"}\n" -"```" -msgstr "" - -#: src/basic-syntax/references.md:14 +#: src/basic-syntax/references.md:15 msgid "Some notes:" msgstr "" -#: src/basic-syntax/references.md:16 +#: src/basic-syntax/references.md:17 msgid "" "We must dereference `ref_x` when assigning to it, similar to C and C++ " "pointers." msgstr "" -#: src/basic-syntax/references.md:17 +#: src/basic-syntax/references.md:18 msgid "" "Rust will auto-dereference in some cases, in particular when invoking " "methods (try `ref_x.count_ones()`)." msgstr "" -#: src/basic-syntax/references.md:19 +#: src/basic-syntax/references.md:20 msgid "" "References that are declared as `mut` can be bound to different values over " "their lifetime." msgstr "" -#: src/basic-syntax/references.md:25 +#: src/basic-syntax/references.md:26 msgid "" "Be sure to note the difference between `let mut ref_x: &i32` and `let ref_x: " "&mut i32`. The first one represents a mutable reference which can be bound " @@ -2710,31 +3113,17 @@ msgstr "" msgid "Rust will statically forbid dangling references:" msgstr "" -#: src/basic-syntax/references-dangling.md:5 -msgid "" -"```rust,editable,compile_fail\n" -"fn main() {\n" -" let ref_x: &i32;\n" -" {\n" -" let x: i32 = 10;\n" -" ref_x = &x;\n" -" }\n" -" println!(\"ref_x: {ref_x}\");\n" -"}\n" -"```" -msgstr "" - -#: src/basic-syntax/references-dangling.md:16 +#: src/basic-syntax/references-dangling.md:17 msgid "A reference is said to \"borrow\" the value it refers to." msgstr "" -#: src/basic-syntax/references-dangling.md:17 +#: src/basic-syntax/references-dangling.md:18 msgid "" "Rust is tracking the lifetimes of all references to ensure they live long " "enough." msgstr "" -#: src/basic-syntax/references-dangling.md:19 +#: src/basic-syntax/references-dangling.md:20 msgid "We will talk more about borrowing when we get to ownership." msgstr "" @@ -2742,66 +3131,52 @@ msgstr "" msgid "A slice gives you a view into a larger collection:" msgstr "" -#: src/basic-syntax/slices.md:5 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let mut a: [i32; 6] = [10, 20, 30, 40, 50, 60];\n" -" println!(\"a: {a:?}\");\n" -"\n" -" let s: &[i32] = &a[2..4];\n" -"\n" -" println!(\"s: {s:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/basic-syntax/slices.md:16 +#: src/basic-syntax/slices.md:17 msgid "Slices borrow data from the sliced type." msgstr "" -#: src/basic-syntax/slices.md:17 +#: src/basic-syntax/slices.md:18 msgid "Question: What happens if you modify `a[3]` right before printing `s`?" msgstr "" -#: src/basic-syntax/slices.md:21 +#: src/basic-syntax/slices.md:22 msgid "" "We create a slice by borrowing `a` and specifying the starting and ending " "indexes in brackets." msgstr "" -#: src/basic-syntax/slices.md:23 +#: src/basic-syntax/slices.md:24 msgid "" "If the slice starts at index 0, Rust’s range syntax allows us to drop the " "starting index, meaning that `&a[0..a.len()]` and `&a[..a.len()]` are " "identical." msgstr "" -#: src/basic-syntax/slices.md:25 +#: src/basic-syntax/slices.md:26 msgid "" "The same is true for the last index, so `&a[2..a.len()]` and `&a[2..]` are " "identical." msgstr "" -#: src/basic-syntax/slices.md:27 +#: src/basic-syntax/slices.md:28 msgid "" "To easily create a slice of the full array, we can therefore use `&a[..]`." msgstr "" -#: src/basic-syntax/slices.md:29 +#: src/basic-syntax/slices.md:30 msgid "" "`s` is a reference to a slice of `i32`s. Notice that the type of `s` " "(`&[i32]`) no longer mentions the array length. This allows us to perform " "computation on slices of different sizes." msgstr "" -#: src/basic-syntax/slices.md:31 +#: src/basic-syntax/slices.md:32 msgid "" "Slices always borrow from another object. In this example, `a` has to remain " "'alive' (in scope) for at least as long as our slice. " msgstr "" -#: src/basic-syntax/slices.md:33 +#: src/basic-syntax/slices.md:34 msgid "" "The question about modifying `a[3]` can spark an interesting discussion, but " "the answer is that for memory safety reasons you cannot do it through `a` at " @@ -2895,62 +3270,31 @@ msgid "" "Fizz_buzz) interview question:" msgstr "" -#: src/basic-syntax/functions.md:5 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" print_fizzbuzz_to(20);\n" -"}\n" -"\n" -"fn is_divisible(n: u32, divisor: u32) -> bool {\n" -" if divisor == 0 {\n" -" return false;\n" -" }\n" -" n % divisor == 0\n" -"}\n" -"\n" -"fn fizzbuzz(n: u32) -> String {\n" -" let fizz = if is_divisible(n, 3) { \"fizz\" } else { \"\" };\n" -" let buzz = if is_divisible(n, 5) { \"buzz\" } else { \"\" };\n" -" if fizz.is_empty() && buzz.is_empty() {\n" -" return format!(\"{n}\");\n" -" }\n" -" format!(\"{fizz}{buzz}\")\n" -"}\n" -"\n" -"fn print_fizzbuzz_to(n: u32) {\n" -" for i in 1..=n {\n" -" println!(\"{}\", fizzbuzz(i));\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/basic-syntax/functions.md:35 +#: src/basic-syntax/functions.md:36 msgid "" "We refer in `main` to a function written below. Neither forward declarations " "nor headers are necessary. " msgstr "" -#: src/basic-syntax/functions.md:36 +#: src/basic-syntax/functions.md:37 msgid "" "Declaration parameters are followed by a type (the reverse of some " "programming languages), then a return type." msgstr "" -#: src/basic-syntax/functions.md:37 +#: src/basic-syntax/functions.md:38 msgid "" "The last expression in a function body (or any block) becomes the return " "value. Simply omit the `;` at the end of the expression." msgstr "" -#: src/basic-syntax/functions.md:38 +#: src/basic-syntax/functions.md:39 msgid "" "Some functions have no return value, and return the 'unit type', `()`. The " "compiler will infer this if the `-> ()` return type is omitted." msgstr "" -#: src/basic-syntax/functions.md:39 +#: src/basic-syntax/functions.md:40 msgid "" "The range expression in the `for` loop in `print_fizzbuzz_to()` contains " "`=n`, which causes it to include the upper bound." @@ -2968,6 +3312,11 @@ msgid "" "argument.\n" "///\n" "/// If the second argument is zero, the result is false.\n" +"///\n" +"/// # Example\n" +"/// ```\n" +"/// assert!(is_divisible_by(42, 2));\n" +"/// ```\n" "fn is_divisible_by(lhs: u32, rhs: u32) -> bool {\n" " if rhs == 0 {\n" " return false; // Corner case, early return\n" @@ -2978,33 +3327,34 @@ msgid "" "```" msgstr "" -#: src/basic-syntax/rustdoc.md:17 +#: src/basic-syntax/rustdoc.md:22 msgid "" "The contents are treated as Markdown. All published Rust library crates are " "automatically documented at [`docs.rs`](https://docs.rs) using the [rustdoc]" "(https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) tool. It is " -"idiomatic to document all public items in an API using this pattern." +"idiomatic to document all public items in an API using this pattern. Code " +"snippets can document usage and will be used as unit tests." msgstr "" -#: src/basic-syntax/rustdoc.md:24 +#: src/basic-syntax/rustdoc.md:30 msgid "" "Show students the generated docs for the `rand` crate at [`docs.rs/rand`]" "(https://docs.rs/rand)." msgstr "" -#: src/basic-syntax/rustdoc.md:27 +#: src/basic-syntax/rustdoc.md:33 msgid "" "This course does not include rustdoc on slides, just to save space, but in " "real code they should be present." msgstr "" -#: src/basic-syntax/rustdoc.md:30 +#: src/basic-syntax/rustdoc.md:36 msgid "" "Inner doc comments are discussed later (in the page on modules) and need not " "be addressed here." msgstr "" -#: src/basic-syntax/rustdoc.md:33 +#: src/basic-syntax/rustdoc.md:39 msgid "" "Rustdoc comments can contain code snippets that we can run and test using " "`cargo test`. We will discuss these tests in the [Testing section](../" @@ -3054,15 +3404,6 @@ msgstr "" msgid "Add a static method called `Rectangle::new` and call this from `main`:" msgstr "" -#: src/basic-syntax/methods.md:36 -msgid "" -"```rust,editable,compile_fail\n" -"fn new(width: u32, height: u32) -> Rectangle {\n" -" Rectangle { width, height }\n" -"}\n" -"```" -msgstr "" - #: src/basic-syntax/methods.md:42 msgid "" "While _technically_, Rust does not have custom constructors, static methods " @@ -3186,23 +3527,7 @@ msgid "" "implicit_conversion)). You can see this in a program like this:" msgstr "" -#: src/exercises/day-1/implicit-conversions.md:6 -msgid "" -"```rust,editable,compile_fail\n" -"fn multiply(x: i16, y: i16) -> i16 {\n" -" x * y\n" -"}\n" -"\n" -"fn main() {\n" -" let x: i8 = 15;\n" -" let y: i16 = 1000;\n" -"\n" -" println!(\"{x} * {y} = {}\", multiply(x, y));\n" -"}\n" -"```" -msgstr "" - -#: src/exercises/day-1/implicit-conversions.md:19 +#: src/exercises/day-1/implicit-conversions.md:20 msgid "" "The Rust integer types all implement the [`From`](https://doc.rust-lang." "org/std/convert/trait.From.html) and [`Into`](https://doc.rust-lang.org/" @@ -3212,7 +3537,7 @@ msgid "" "expresses that it can be converted into another type." msgstr "" -#: src/exercises/day-1/implicit-conversions.md:25 +#: src/exercises/day-1/implicit-conversions.md:26 msgid "" "The standard library has an implementation of `From for i16`, which " "means that we can convert a variable `x` of type `i8` to an `i16` by " @@ -3221,22 +3546,22 @@ msgid "" "i8`." msgstr "" -#: src/exercises/day-1/implicit-conversions.md:30 +#: src/exercises/day-1/implicit-conversions.md:31 msgid "" "The same applies for your own `From` implementations for your own types, so " "it is sufficient to only implement `From` to get a respective `Into` " "implementation automatically." msgstr "" -#: src/exercises/day-1/implicit-conversions.md:33 +#: src/exercises/day-1/implicit-conversions.md:34 msgid "Execute the above program and look at the compiler error." msgstr "" -#: src/exercises/day-1/implicit-conversions.md:35 +#: src/exercises/day-1/implicit-conversions.md:36 msgid "Update the code above to use `into()` to do the conversion." msgstr "" -#: src/exercises/day-1/implicit-conversions.md:37 +#: src/exercises/day-1/implicit-conversions.md:38 msgid "" "Change the types of `x` and `y` to other things (such as `f32`, `bool`, " "`i128`) to see which types you can convert to which other types. Try " @@ -3254,36 +3579,19 @@ msgstr "" msgid "We saw that an array can be declared like this:" msgstr "" -#: src/exercises/day-1/for-loops.md:5 -msgid "" -"```rust\n" -"let array = [10, 20, 30];\n" -"```" -msgstr "" - #: src/exercises/day-1/for-loops.md:9 msgid "" "You can print such an array by asking for its debug representation with `{:?}" "`:" msgstr "" -#: src/exercises/day-1/for-loops.md:11 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let array = [10, 20, 30];\n" -" println!(\"array: {array:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/exercises/day-1/for-loops.md:18 +#: src/exercises/day-1/for-loops.md:19 msgid "" "Rust lets you iterate over things like arrays and ranges using the `for` " "keyword:" msgstr "" -#: src/exercises/day-1/for-loops.md:21 +#: src/exercises/day-1/for-loops.md:22 msgid "" "```rust,editable\n" "fn main() {\n" @@ -3303,33 +3611,24 @@ msgid "" "```" msgstr "" -#: src/exercises/day-1/for-loops.md:38 +#: src/exercises/day-1/for-loops.md:39 msgid "" "Use the above to write a function `pretty_print` which pretty-print a matrix " "and a function `transpose` which will transpose a matrix (turn rows into " "columns):" msgstr "" -#: src/exercises/day-1/for-loops.md:41 -msgid "" -"```bob\n" -" ⎛⎡1 2 3⎤⎞ ⎡1 4 7⎤\n" -"\"transpose\"⎜⎢4 5 6⎥⎟ \"==\"⎢2 5 8⎥\n" -" ⎝⎣7 8 9⎦⎠ ⎣3 6 9⎦\n" -"```" -msgstr "" - -#: src/exercises/day-1/for-loops.md:47 +#: src/exercises/day-1/for-loops.md:49 msgid "Hard-code both functions to operate on 3 × 3 matrices." msgstr "" -#: src/exercises/day-1/for-loops.md:49 +#: src/exercises/day-1/for-loops.md:51 msgid "" "Copy the code below to and implement the " "functions:" msgstr "" -#: src/exercises/day-1/for-loops.md:52 +#: src/exercises/day-1/for-loops.md:54 msgid "" "```rust,should_panic\n" "// TODO: remove this when you're done with your implementation.\n" @@ -3360,50 +3659,50 @@ msgid "" "```" msgstr "" -#: src/exercises/day-1/for-loops.md:80 +#: src/exercises/day-1/for-loops.md:82 msgid "Bonus Question" msgstr "" -#: src/exercises/day-1/for-loops.md:82 +#: src/exercises/day-1/for-loops.md:84 msgid "" "Could you use `&[i32]` slices instead of hard-coded 3 × 3 matrices for your " "argument and return types? Something like `&[&[i32]]` for a two-dimensional " "slice-of-slices. Why or why not?" msgstr "" -#: src/exercises/day-1/for-loops.md:87 +#: src/exercises/day-1/for-loops.md:89 msgid "" "See the [`ndarray` crate](https://docs.rs/ndarray/) for a production quality " "implementation." msgstr "" -#: src/exercises/day-1/for-loops.md:92 +#: src/exercises/day-1/for-loops.md:94 msgid "" "The solution and the answer to the bonus section are available in the " "[Solution](solutions-morning.md#arrays-and-for-loops) section." msgstr "" -#: src/exercises/day-1/for-loops.md:95 +#: src/exercises/day-1/for-loops.md:97 msgid "" "The use of the reference `&array` within `for n in &array` is a subtle " "preview of issues of ownership that will come later in the afternoon." msgstr "" -#: src/exercises/day-1/for-loops.md:98 +#: src/exercises/day-1/for-loops.md:100 msgid "Without the `&`..." msgstr "" -#: src/exercises/day-1/for-loops.md:99 +#: src/exercises/day-1/for-loops.md:101 msgid "" "The loop would have been one that consumes the array. This is a change " "[introduced in the 2021 Edition](https://doc.rust-lang.org/edition-guide/" "rust-2021/IntoIterator-for-arrays.html)." msgstr "" -#: src/exercises/day-1/for-loops.md:102 +#: src/exercises/day-1/for-loops.md:104 msgid "" -"An implicit array copy would have occured. Since `i32` is a copy type, then " -"`[i32; 3]` is also a copy type." +"An implicit array copy would have occurred. Since `i32` is a copy type, " +"then `[i32; 3]` is also a copy type." msgstr "" #: src/control-flow.md:3 @@ -3420,66 +3719,31 @@ msgid "" "and a type, which are those of the last expression of the block:" msgstr "" -#: 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" -"}\n" -"```" -msgstr "" - -#: src/control-flow/blocks.md:26 +#: src/control-flow/blocks.md:27 msgid "" "If the last expression ends with `;`, then the resulting value and type is " "`()`." msgstr "" -#: src/control-flow/blocks.md:28 +#: src/control-flow/blocks.md:29 msgid "" "The same rule is used for functions: the value of the function body is the " "return value:" msgstr "" -#: 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:43 src/enums.md:34 src/enums/sizes.md:28 +#: src/control-flow/blocks.md:45 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 msgid "Key Points:" msgstr "" -#: src/control-flow/blocks.md:44 +#: src/control-flow/blocks.md:46 msgid "" "The point of this slide is to show that blocks have a type and value in " "Rust. " msgstr "" -#: src/control-flow/blocks.md:45 +#: src/control-flow/blocks.md:47 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`." @@ -3495,40 +3759,12 @@ msgid "" "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 msgid "" "In addition, you can use `if` as an expression. The last expression of each " "block becomes the value of the `if` expression:" msgstr "" -#: 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 " @@ -3547,42 +3783,25 @@ msgid "" "automatically call `into_iter()` on the expression and then iterate over it:" msgstr "" -#: 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 +#: src/control-flow/for-expressions.md:22 msgid "You can use `break` and `continue` here as usual." msgstr "" -#: src/control-flow/for-expressions.md:25 +#: src/control-flow/for-expressions.md:26 msgid "Index iteration is not a special syntax in Rust for just that case." msgstr "" -#: src/control-flow/for-expressions.md:26 +#: src/control-flow/for-expressions.md:27 msgid "`(0..10)` is a range that implements an `Iterator` trait. " msgstr "" -#: src/control-flow/for-expressions.md:27 +#: src/control-flow/for-expressions.md:28 msgid "" "`step_by` is a method that returns another `Iterator` that skips every other " "element. " msgstr "" -#: src/control-flow/for-expressions.md:28 +#: src/control-flow/for-expressions.md:29 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()`." @@ -3598,23 +3817,6 @@ msgid "" "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 msgid "`break` and `continue`" msgstr "" @@ -3637,28 +3839,7 @@ msgid "" "used to break out of nested loops:" msgstr "" -#: 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 +#: src/control-flow/break-continue.md:29 msgid "" "In this case we break the outer loop after 3 iterations of the inner loop." msgstr "" @@ -3677,31 +3858,11 @@ msgstr "" msgid "Here you must either `break` or `return` to stop the loop:" msgstr "" -#: 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 +#: src/control-flow/loop-expressions.md:28 msgid "Break the `loop` with a value (e.g. `break 8`) and print it out." msgstr "" -#: src/control-flow/loop-expressions.md:28 +#: src/control-flow/loop-expressions.md:29 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 " @@ -3714,19 +3875,7 @@ msgid "" "by default:" msgstr "" -#: src/basic-syntax/variables.md:6 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let x: i32 = 10;\n" -" println!(\"x: {x}\");\n" -" // x = 20;\n" -" // println!(\"x: {x}\");\n" -"}\n" -"```" -msgstr "" - -#: src/basic-syntax/variables.md:17 +#: src/basic-syntax/variables.md:18 msgid "" "Due to type inference the `i32` is optional. We will gradually show the " "types less and less as the course progresses." @@ -3736,35 +3885,13 @@ msgstr "" msgid "Rust will look at how the variable is _used_ to determine the type:" msgstr "" -#: src/basic-syntax/type-inference.md:5 -msgid "" -"```rust,editable\n" -"fn takes_u32(x: u32) {\n" -" println!(\"u32: {x}\");\n" -"}\n" -"\n" -"fn takes_i8(y: i8) {\n" -" println!(\"i8: {y}\");\n" -"}\n" -"\n" -"fn main() {\n" -" let x = 10;\n" -" let y = 20;\n" -"\n" -" takes_u32(x);\n" -" takes_i8(y);\n" -" // takes_u32(y);\n" -"}\n" -"```" -msgstr "" - -#: src/basic-syntax/type-inference.md:26 +#: src/basic-syntax/type-inference.md:27 msgid "" "This slide demonstrates how the Rust compiler infers types based on " "constraints given by variable declarations and usages." msgstr "" -#: src/basic-syntax/type-inference.md:28 +#: src/basic-syntax/type-inference.md:29 msgid "" "It is very important to emphasize that variables declared like this are not " "of some sort of dynamic \"any type\" that can hold any data. The machine " @@ -3773,29 +3900,14 @@ msgid "" "code." msgstr "" -#: src/basic-syntax/type-inference.md:32 +#: src/basic-syntax/type-inference.md:33 msgid "" "The following code tells the compiler to copy into a certain generic " "container without the code ever explicitly specifying the contained type, " "using `_` as a placeholder:" msgstr "" -#: src/basic-syntax/type-inference.md:34 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let mut v = Vec::new();\n" -" v.push((10, false));\n" -" v.push((20, true));\n" -" println!(\"v: {v:?}\");\n" -"\n" -" let vv = v.iter().collect::>();\n" -" println!(\"vv: {vv:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/basic-syntax/type-inference.md:46 +#: src/basic-syntax/type-inference.md:48 msgid "" "[`collect`](https://doc.rust-lang.org/stable/std/iter/trait.Iterator." "html#method.collect) relies on [`FromIterator`](https://doc.rust-lang.org/" @@ -3825,51 +3937,29 @@ msgid "" "inlined wherever they are used:" msgstr "" -#: src/basic-syntax/static-and-const.md:11 -msgid "" -"```rust,editable\n" -"const DIGEST_SIZE: usize = 3;\n" -"const ZERO: Option = Some(42);\n" -"\n" -"fn compute_digest(text: &str) -> [u8; DIGEST_SIZE] {\n" -" let mut digest = [ZERO.unwrap_or(0); DIGEST_SIZE];\n" -" for (idx, &b) in text.as_bytes().iter().enumerate() {\n" -" digest[idx % DIGEST_SIZE] = digest[idx % DIGEST_SIZE]." -"wrapping_add(b);\n" -" }\n" -" digest\n" -"}\n" -"\n" -"fn main() {\n" -" let digest = compute_digest(\"Hello\");\n" -" println!(\"Digest: {digest:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/basic-syntax/static-and-const.md:29 +#: src/basic-syntax/static-and-const.md:30 msgid "" "According to the [Rust RFC Book](https://rust-lang.github.io/rfcs/0246-const-" "vs-static.html) these are inlined upon use." msgstr "" -#: src/basic-syntax/static-and-const.md:31 +#: src/basic-syntax/static-and-const.md:32 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 +#: src/basic-syntax/static-and-const.md:34 msgid "`static`" msgstr "" -#: src/basic-syntax/static-and-const.md:35 +#: src/basic-syntax/static-and-const.md:36 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:37 +#: src/basic-syntax/static-and-const.md:38 msgid "" "```rust,editable\n" "static BANNER: &str = \"Welcome to RustOS 3.14\";\n" @@ -3880,7 +3970,7 @@ msgid "" "```" msgstr "" -#: src/basic-syntax/static-and-const.md:45 +#: src/basic-syntax/static-and-const.md:46 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 " @@ -3890,7 +3980,7 @@ msgid "" "`const` is generally preferred." msgstr "" -#: src/basic-syntax/static-and-const.md:49 +#: src/basic-syntax/static-and-const.md:50 msgid "" "Because `static` variables are accessible from any thread, they must be " "`Sync`. Interior mutability is possible through a [`Mutex`](https://doc.rust-" @@ -3900,90 +3990,90 @@ msgid "" "unsafe/mutable-static-variables.md) in the chapter on Unsafe Rust." msgstr "" -#: src/basic-syntax/static-and-const.md:57 +#: src/basic-syntax/static-and-const.md:58 msgid "Mention that `const` behaves semantically similar to C++'s `constexpr`." msgstr "" -#: src/basic-syntax/static-and-const.md:58 +#: src/basic-syntax/static-and-const.md:59 msgid "" "`static`, on the other hand, is much more similar to a `const` or mutable " "global variable in C++." msgstr "" -#: src/basic-syntax/static-and-const.md:59 +#: src/basic-syntax/static-and-const.md:60 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 +#: src/basic-syntax/static-and-const.md:61 msgid "" "It isn't super common that one would need a runtime evaluated constant, but " "it is helpful and safer than using a static." msgstr "" -#: src/basic-syntax/static-and-const.md:61 +#: src/basic-syntax/static-and-const.md:62 msgid "`thread_local` data can be created with the macro `std::thread_local`." msgstr "" -#: src/basic-syntax/static-and-const.md:63 +#: src/basic-syntax/static-and-const.md:64 msgid "Properties table:" msgstr "" -#: src/basic-syntax/static-and-const.md:65 +#: src/basic-syntax/static-and-const.md:66 msgid "Property" msgstr "" -#: src/basic-syntax/static-and-const.md:65 +#: src/basic-syntax/static-and-const.md:66 msgid "Static" msgstr "" -#: src/basic-syntax/static-and-const.md:65 +#: src/basic-syntax/static-and-const.md:66 msgid "Constant" msgstr "" -#: src/basic-syntax/static-and-const.md:67 +#: src/basic-syntax/static-and-const.md:68 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:69 #: src/basic-syntax/static-and-const.md:71 +#: src/basic-syntax/static-and-const.md:72 msgid "Yes" msgstr "" -#: src/basic-syntax/static-and-const.md:67 +#: src/basic-syntax/static-and-const.md:68 msgid "No (inlined)" msgstr "" -#: src/basic-syntax/static-and-const.md:68 +#: src/basic-syntax/static-and-const.md:69 msgid "Lives for the entire duration of the program" msgstr "" -#: src/basic-syntax/static-and-const.md:68 #: src/basic-syntax/static-and-const.md:69 -#: src/basic-syntax/static-and-const.md:71 +#: src/basic-syntax/static-and-const.md:70 +#: src/basic-syntax/static-and-const.md:72 msgid "No" msgstr "" -#: src/basic-syntax/static-and-const.md:69 +#: src/basic-syntax/static-and-const.md:70 msgid "Can be mutable" msgstr "" -#: src/basic-syntax/static-and-const.md:69 +#: src/basic-syntax/static-and-const.md:70 msgid "Yes (unsafe)" msgstr "" -#: src/basic-syntax/static-and-const.md:70 +#: src/basic-syntax/static-and-const.md:71 msgid "Evaluated at compile time" msgstr "" -#: src/basic-syntax/static-and-const.md:70 +#: src/basic-syntax/static-and-const.md:71 msgid "Yes (initialised at compile time)" msgstr "" -#: src/basic-syntax/static-and-const.md:71 +#: src/basic-syntax/static-and-const.md:72 msgid "Inlined wherever it is used" msgstr "" @@ -4037,18 +4127,6 @@ msgid "" "does not change." msgstr "" -#: src/basic-syntax/scopes-shadowing.md:30 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let a = 1;\n" -" let b = &a;\n" -" let a = a + 1;\n" -" println!(\"{a} {b}\");\n" -"}\n" -"```" -msgstr "" - #: src/enums.md:3 msgid "" "The `enum` keyword allows the creation of a type which has a few different " @@ -4250,172 +4328,72 @@ msgid "" "You can control the discriminant if needed (e.g., for compatibility with C):" msgstr "" -#: src/enums/sizes.md:34 -msgid "" -"```rust,editable\n" -"#[repr(u32)]\n" -"enum Bar {\n" -" A, // 0\n" -" B = 10000,\n" -" C, // 10001\n" -"}\n" -"\n" -"fn main() {\n" -" println!(\"A: {}\", Bar::A as u32);\n" -" println!(\"B: {}\", Bar::B as u32);\n" -" println!(\"C: {}\", Bar::C as u32);\n" -"}\n" -"```" -msgstr "" - -#: src/enums/sizes.md:49 +#: src/enums/sizes.md:50 msgid "" "Without `repr`, the discriminant type takes 2 bytes, because 10001 fits 2 " "bytes." msgstr "" -#: src/enums/sizes.md:53 +#: src/enums/sizes.md:54 msgid "Try out other types such as" msgstr "" -#: src/enums/sizes.md:55 +#: src/enums/sizes.md:56 msgid "`dbg_size!(bool)`: size 1 bytes, align: 1 bytes," msgstr "" -#: src/enums/sizes.md:56 +#: src/enums/sizes.md:57 msgid "" "`dbg_size!(Option)`: size 1 bytes, align: 1 bytes (niche optimization, " "see below)," msgstr "" -#: src/enums/sizes.md:57 +#: src/enums/sizes.md:58 msgid "`dbg_size!(&i32)`: size 8 bytes, align: 8 bytes (on a 64-bit machine)," msgstr "" -#: src/enums/sizes.md:58 +#: src/enums/sizes.md:59 msgid "" "`dbg_size!(Option<&i32>)`: size 8 bytes, align: 8 bytes (null pointer " "optimization, see below)." msgstr "" -#: src/enums/sizes.md:60 +#: src/enums/sizes.md:61 src/memory-management/stack.md:32 +msgid "More to Explore" +msgstr "" + +#: src/enums/sizes.md:63 +msgid "" +"Rust has several optimizations it can employ to make enums take up less " +"space." +msgstr "" + +#: src/enums/sizes.md:65 msgid "" "Niche optimization: Rust will merge unused bit patterns for the enum " "discriminant." msgstr "" -#: src/enums/sizes.md:63 +#: src/enums/sizes.md:68 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:67 +#: src/enums/sizes.md:72 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:70 -msgid "" -"```rust,editable\n" -"use std::mem::transmute;\n" -"\n" -"macro_rules! dbg_bits {\n" -" ($e:expr, $bit_type:ty) => {\n" -" println!(\"- {}: {:#x}\", stringify!($e), transmute::<_, " -"$bit_type>($e));\n" -" };\n" -"}\n" -"\n" -"fn main() {\n" -" // TOTALLY UNSAFE. Rust provides no guarantees about the bitwise\n" -" // representation of types.\n" -" unsafe {\n" -" println!(\"Bitwise representation of bool\");\n" -" dbg_bits!(false, u8);\n" -" dbg_bits!(true, u8);\n" -"\n" -" println!(\"Bitwise representation of Option\");\n" -" dbg_bits!(None::, u8);\n" -" dbg_bits!(Some(false), u8);\n" -" dbg_bits!(Some(true), u8);\n" -"\n" -" println!(\"Bitwise representation of Option>\");\n" -" dbg_bits!(Some(Some(false)), u8);\n" -" dbg_bits!(Some(Some(true)), u8);\n" -" dbg_bits!(Some(None::), u8);\n" -" dbg_bits!(None::>, u8);\n" -"\n" -" println!(\"Bitwise representation of Option<&i32>\");\n" -" dbg_bits!(None::<&i32>, usize);\n" -" dbg_bits!(Some(&0i32), usize);\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/enums/sizes.md:105 +#: src/enums/sizes.md:109 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:107 -msgid "" -"```rust,editable\n" -"#![recursion_limit = \"1000\"]\n" -"\n" -"use std::mem::transmute;\n" -"\n" -"macro_rules! dbg_bits {\n" -" ($e:expr, $bit_type:ty) => {\n" -" println!(\"- {}: {:#x}\", stringify!($e), transmute::<_, " -"$bit_type>($e));\n" -" };\n" -"}\n" -"\n" -"// Macro to wrap a value in 2^n Some() where n is the number of \"@\" " -"signs.\n" -"// Increasing the recursion limit is required to evaluate this macro.\n" -"macro_rules! many_options {\n" -" ($value:expr) => { Some($value) };\n" -" ($value:expr, @) => {\n" -" Some(Some($value))\n" -" };\n" -" ($value:expr, @ $($more:tt)+) => {\n" -" many_options!(many_options!($value, $($more)+), $($more)+)\n" -" };\n" -"}\n" -"\n" -"fn main() {\n" -" // TOTALLY UNSAFE. Rust provides no guarantees about the bitwise\n" -" // representation of types.\n" -" unsafe {\n" -" assert_eq!(many_options!(false), Some(false));\n" -" assert_eq!(many_options!(false, @), Some(Some(false)));\n" -" assert_eq!(many_options!(false, @@), " -"Some(Some(Some(Some(false)))));\n" -"\n" -" println!(\"Bitwise representation of a chain of 128 Option's.\");\n" -" dbg_bits!(many_options!(false, @@@@@@@), u8);\n" -" dbg_bits!(many_options!(true, @@@@@@@), u8);\n" -"\n" -" println!(\"Bitwise representation of a chain of 256 Option's.\");\n" -" dbg_bits!(many_options!(false, @@@@@@@@), u16);\n" -" dbg_bits!(many_options!(true, @@@@@@@@), u16);\n" -"\n" -" println!(\"Bitwise representation of a chain of 257 Option's.\");\n" -" dbg_bits!(many_options!(Some(false), @@@@@@@@), u16);\n" -" dbg_bits!(many_options!(Some(true), @@@@@@@@), u16);\n" -" dbg_bits!(many_options!(None::, @@@@@@@@), u16);\n" -" }\n" -"}\n" -"```" -msgstr "" - #: src/control-flow/novel.md:3 msgid "" "Rust has a few control flow constructs which differ from other languages. " @@ -4427,9 +4405,8 @@ msgid "`if let` expressions" msgstr "" #: src/control-flow/novel.md:7 -#, fuzzy msgid "`while let` expressions" -msgstr "while let İfadesi" +msgstr "`while let` ifadeleri" #: src/control-flow/novel.md:8 src/control-flow/match-expressions.md:1 msgid "`match` expressions" @@ -4457,7 +4434,7 @@ msgid "" msgstr "" #: src/control-flow/if-let-expressions.md:18 -#: src/control-flow/while-let-expressions.md:21 +#: src/control-flow/while-let-expressions.md:22 #: src/control-flow/match-expressions.md:23 msgid "" "See [pattern matching](../pattern-matching.md) for more details on patterns " @@ -4487,24 +4464,6 @@ msgid "" "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" -"\n" -"```" -msgstr "" - #: src/control-flow/while-let-expressions.md:1 msgid "`while let` loops" msgstr "" @@ -4516,21 +4475,7 @@ msgid "" "repeatedly tests a value against a pattern:" msgstr "" -#: 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 +#: src/control-flow/while-let-expressions.md:18 msgid "" "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 " @@ -4538,13 +4483,13 @@ msgid "" "items." msgstr "" -#: src/control-flow/while-let-expressions.md:26 +#: src/control-flow/while-let-expressions.md:27 msgid "" "Point out that the `while let` loop will keep going as long as the value " "matches the pattern." msgstr "" -#: src/control-flow/while-let-expressions.md:27 +#: src/control-flow/while-let-expressions.md:28 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()`. " @@ -4607,7 +4552,7 @@ msgstr "" #: src/pattern-matching.md:3 msgid "" -"The `match` keyword let you match a value against one or more _patterns_. " +"The `match` keyword lets you match a value against one or more _patterns_. " "The comparisons are done from top to bottom and the first match wins." msgstr "" @@ -4888,9 +4833,8 @@ msgid "We will look at two things:" msgstr "" #: src/exercises/day-1/afternoon.md:5 -#, fuzzy msgid "The Luhn algorithm," -msgstr "Luhn Algrotiması" +msgstr "Luhn Algortiması," #: src/exercises/day-1/afternoon.md:7 msgid "An exercise on pattern matching." @@ -4923,8 +4867,8 @@ msgstr "" #: src/exercises/day-1/luhn.md:12 msgid "" -"After doubling a digit, sum the digits. So doubling `7` becomes `14` which " -"becomes `5`." +"After doubling a digit, sum the digits if the result is greater than 9. So " +"doubling `7` becomes `14` which becomes `1 + 4 = 5`." msgstr "" #: src/exercises/day-1/luhn.md:15 @@ -4960,6 +4904,7 @@ msgid "" "#[test]\n" "fn test_non_digit_cc_number() {\n" " assert!(!luhn(\"foo\"));\n" +" assert!(!luhn(\"foo 0 0\"));\n" "}\n" "\n" "#[test]\n" @@ -4999,6 +4944,140 @@ msgid "" "```" msgstr "" +#: src/exercises/day-1/pattern-matching.md:1 +msgid "Exercise: Expression Evaluation" +msgstr "" + +#: src/exercises/day-1/pattern-matching.md:3 +msgid "Let's write a simple recursive evaluator for arithmetic expressions. " +msgstr "" + +#: src/exercises/day-1/pattern-matching.md:5 +msgid "" +"```rust\n" +"/// An operation to perform on two subexpressions.\n" +"#[derive(Debug)]\n" +"enum Operation {\n" +" Add,\n" +" Sub,\n" +" Mul,\n" +" Div,\n" +"}\n" +"\n" +"/// An expression, in tree form.\n" +"#[derive(Debug)]\n" +"enum Expression {\n" +" /// An operation on two subexpressions.\n" +" Op {\n" +" op: Operation,\n" +" left: Box,\n" +" right: Box,\n" +" },\n" +"\n" +" /// A literal value\n" +" Value(i64),\n" +"}\n" +"\n" +"/// The result of evaluating an expression.\n" +"#[derive(Debug, PartialEq, Eq)]\n" +"enum Res {\n" +" /// Evaluation was successful, with the given result.\n" +" Ok(i64),\n" +" /// Evaluation failed, with the given error message.\n" +" Err(String),\n" +"}\n" +"// Allow `Ok` and `Err` as shorthands for `Res::Ok` and `Res::Err`.\n" +"use Res::{Err, Ok};\n" +"\n" +"fn eval(e: Expression) -> Res {\n" +" todo!()\n" +"}\n" +"\n" +"#[test]\n" +"fn test_value() {\n" +" assert_eq!(eval(Expression::Value(19)), Ok(19));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_sum() {\n" +" assert_eq!(\n" +" eval(Expression::Op {\n" +" op: Operation::Add,\n" +" left: Box::new(Expression::Value(10)),\n" +" right: Box::new(Expression::Value(20)),\n" +" }),\n" +" Ok(30)\n" +" );\n" +"}\n" +"\n" +"#[test]\n" +"fn test_recursion() {\n" +" let term1 = Expression::Op {\n" +" op: Operation::Mul,\n" +" left: Box::new(Expression::Value(10)),\n" +" right: Box::new(Expression::Value(9)),\n" +" };\n" +" let term2 = Expression::Op {\n" +" op: Operation::Mul,\n" +" left: Box::new(Expression::Op {\n" +" op: Operation::Sub,\n" +" left: Box::new(Expression::Value(3)),\n" +" right: Box::new(Expression::Value(4)),\n" +" }),\n" +" right: Box::new(Expression::Value(5)),\n" +" };\n" +" assert_eq!(\n" +" eval(Expression::Op {\n" +" op: Operation::Add,\n" +" left: Box::new(term1),\n" +" right: Box::new(term2),\n" +" }),\n" +" Ok(85)\n" +" );\n" +"}\n" +"\n" +"#[test]\n" +"fn test_error() {\n" +" assert_eq!(\n" +" eval(Expression::Op {\n" +" op: Operation::Div,\n" +" left: Box::new(Expression::Value(99)),\n" +" right: Box::new(Expression::Value(0)),\n" +" }),\n" +" Err(String::from(\"division by zero\"))\n" +" );\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/day-1/pattern-matching.md:100 +msgid "" +"The `Box` type here is a smart pointer, and will be covered in detail later " +"in the course. An expression can be \"boxed\" with `Box::new` as seen in the " +"tests. To evaluate a boxed expression, use the deref operator to \"unbox\" " +"it: `eval(*boxed_expr)`." +msgstr "" + +#: src/exercises/day-1/pattern-matching.md:105 +msgid "" +"Some expressions cannot be evaluated and will return an error. The `Res` " +"type represents either a successful value or an error with a message. This " +"is very similar to the standard-library `Result` which we will see later." +msgstr "" + +#: src/exercises/day-1/pattern-matching.md:109 +msgid "" +"Copy and paste the code into the Rust playground, and begin implementing " +"`eval`. The final product should pass the tests. It may be helpful to use " +"`todo!()` and get the tests to pass one-by-one." +msgstr "" + +#: src/exercises/day-1/pattern-matching.md:113 +msgid "" +"If you finish early, try writing a test that results in an integer overflow. " +"How could you handle this with `Res::Err` instead of a panic?" +msgstr "" + #: src/welcome-day-2.md:1 msgid "Welcome to Day 2" msgstr "" @@ -5019,9 +5098,8 @@ msgid "" msgstr "" #: src/welcome-day-2.md:10 -#, fuzzy msgid "Structs and methods." -msgstr "Stringler ve Yineleyiciler" +msgstr "Yapılar ve metotlar." #: src/welcome-day-2.md:12 msgid "" @@ -5106,9 +5184,8 @@ msgid "No guarantee of memory locality." msgstr "" #: src/memory-management/stack.md:1 -#, fuzzy msgid "Stack and Heap Example" -msgstr "Stack vs Heap" +msgstr "Stack vs Heap Örneği" #: src/memory-management/stack.md:3 msgid "" @@ -5125,23 +5202,6 @@ msgid "" "```" 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 " @@ -5156,13 +5216,13 @@ msgid "" "[Allocator API](https://doc.rust-lang.org/std/alloc/index.html)" msgstr "" -#: src/memory-management/stack.md:32 +#: src/memory-management/stack.md:34 msgid "" -"We can inspect the memory layout with `unsafe` code. However, you should " +"We can inspect the memory layout with `unsafe` Rust. However, you should " "point out that this is rightfully unsafe!" msgstr "" -#: src/memory-management/stack.md:34 +#: src/memory-management/stack.md:37 msgid "" "```rust,editable\n" "fn main() {\n" @@ -5271,14 +5331,6 @@ msgid "" "Special move constructors are used when passing ownership to a function:" msgstr "" -#: 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 msgid "Automatic Memory Management" msgstr "" @@ -5329,27 +5381,20 @@ msgid "Safe and correct like Java, but without a garbage collector." msgstr "" #: src/memory-management/rust.md:6 -msgid "" -"Depending on which abstraction (or combination of abstractions) you choose, " -"can be a single unique pointer, reference counted, or atomically reference " -"counted." -msgstr "" - -#: src/memory-management/rust.md:7 msgid "Scope-based like C++, but the compiler enforces full adherence." msgstr "" -#: src/memory-management/rust.md:8 +#: src/memory-management/rust.md:7 msgid "" "A Rust user can choose the right abstraction for the situation, some even " "have no cost at runtime like C." msgstr "" -#: src/memory-management/rust.md:10 +#: src/memory-management/rust.md:9 msgid "Rust achieves this by modeling _ownership_ explicitly." msgstr "" -#: src/memory-management/rust.md:14 +#: src/memory-management/rust.md:13 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/" @@ -5360,138 +5405,28 @@ msgid "" "errors in C." msgstr "" -#: src/memory-management/rust.md:16 +#: src/memory-management/rust.md:15 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 "" -#: src/memory-management/comparison.md:3 -msgid "Here is a rough comparison of the memory management techniques." -msgstr "" - -#: src/memory-management/comparison.md:5 -msgid "Pros of Different Memory Management Techniques" -msgstr "" - -#: src/memory-management/comparison.md:7 src/memory-management/comparison.md:22 -msgid "Manual like C:" -msgstr "" - -#: src/memory-management/comparison.md:8 src/memory-management/comparison.md:14 -#: src/memory-management/comparison.md:17 -msgid "No runtime overhead." -msgstr "" - -#: src/memory-management/comparison.md:9 src/memory-management/comparison.md:26 -msgid "Automatic like Java:" -msgstr "" - -#: src/memory-management/comparison.md:10 -msgid "Fully automatic." -msgstr "" - -#: src/memory-management/comparison.md:11 -#: src/memory-management/comparison.md:18 -msgid "Safe and correct." -msgstr "" - -#: src/memory-management/comparison.md:12 -#: src/memory-management/comparison.md:29 -msgid "Scope-based like C++:" -msgstr "" - -#: src/memory-management/comparison.md:13 -msgid "Partially automatic." -msgstr "" - -#: src/memory-management/comparison.md:15 -msgid "Compiler-enforced scope-based like Rust:" -msgstr "" - -#: src/memory-management/comparison.md:16 -msgid "Enforced by compiler." -msgstr "" - -#: src/memory-management/comparison.md:20 -msgid "Cons of Different Memory Management Techniques" -msgstr "" - -#: src/memory-management/comparison.md:23 -msgid "Use-after-free." -msgstr "" - -#: src/memory-management/comparison.md:24 -msgid "Double-frees." -msgstr "" - -#: src/memory-management/comparison.md:25 -msgid "Memory leaks." -msgstr "" - -#: src/memory-management/comparison.md:27 -msgid "Garbage collection pauses." -msgstr "" - -#: src/memory-management/comparison.md:28 -msgid "Destructor delays." -msgstr "" - -#: src/memory-management/comparison.md:30 -msgid "Complex, opt-in by programmer (on C++)." -msgstr "" - -#: src/memory-management/comparison.md:31 -msgid "Circular references can lead to memory leaks" -msgstr "" - -#: src/memory-management/comparison.md:32 -msgid "Potential runtime overhead" -msgstr "" - -#: src/memory-management/comparison.md:33 -msgid "Compiler-enforced and scope-based like Rust:" -msgstr "" - -#: src/memory-management/comparison.md:34 -msgid "Some upfront complexity." -msgstr "" - -#: src/memory-management/comparison.md:35 -msgid "Can reject valid programs." -msgstr "" - #: src/ownership.md:3 msgid "" "All variable bindings have a _scope_ where they are valid and it is an error " "to use a variable outside its scope:" msgstr "" -#: 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 +#: src/ownership.md:19 msgid "" "At the end of the scope, the variable is _dropped_ and the data is freed." msgstr "" -#: src/ownership.md:19 +#: src/ownership.md:20 msgid "A destructor can run here to free up resources." msgstr "" -#: src/ownership.md:20 +#: src/ownership.md:21 msgid "We say that the variable _owns_ the value." msgstr "" @@ -5549,51 +5484,23 @@ msgstr "" msgid "In Rust, clones are explicit (by using `clone`)." msgstr "" -#: 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 +#: src/ownership/moved-strings-rust.md:11 msgid "The heap data from `s1` is reused for `s2`." msgstr "" -#: src/ownership/moved-strings-rust.md:11 +#: src/ownership/moved-strings-rust.md:12 msgid "When `s1` goes out of scope, nothing happens (it has been moved from)." msgstr "" -#: src/ownership/moved-strings-rust.md:13 +#: src/ownership/moved-strings-rust.md:14 msgid "Before move to `s2`:" msgstr "" -#: 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 +#: src/ownership/moved-strings-rust.md:31 msgid "After move to `s2`:" msgstr "" -#: src/ownership/moved-strings-rust.md:32 +#: src/ownership/moved-strings-rust.md:33 msgid "" "```bob\n" " Stack Heap\n" @@ -5618,9 +5525,8 @@ msgid "" msgstr "" #: src/ownership/double-free-modern-cpp.md:1 -#, fuzzy -msgid "Extra Work in Modern C++" -msgstr "Modern C++'da Çifte Serbestlik" +msgid "Defensive Copies in Modern C++" +msgstr "Modern C++'da Savunma Amaçlı Kopyalamalar" #: src/ownership/double-free-modern-cpp.md:3 msgid "Modern C++ solves this differently:" @@ -5647,49 +5553,30 @@ msgstr "" msgid "Before copy-assignment:" msgstr "" -#: 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 msgid "After copy-assignment:" msgstr "" -#: src/ownership/double-free-modern-cpp.md:32 +#: src/ownership/double-free-modern-cpp.md:57 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" -"```" +"C++ has made a slightly different choice than Rust. Because `=` copies data, " +"the string data has to be cloned. Otherwise we would get a double-free when " +"either string goes out of scope." +msgstr "" + +#: src/ownership/double-free-modern-cpp.md:61 +msgid "" +"C++ also has [`std::move`](https://en.cppreference.com/w/cpp/utility/move), " +"which is used to indicate when a value may be moved from. If the example had " +"been `s2 = std::move(s1)`, no heap allocation would take place. After the " +"move, `s1` would be in a valid but unspecified state. Unlike Rust, the " +"programmer is allowed to keep using `s1`." +msgstr "" + +#: src/ownership/double-free-modern-cpp.md:66 +msgid "" +"Unlike Rust, `=` in C++ can run arbitrary code as determined by the type " +"which is being copied or moved." msgstr "" #: src/ownership/moves-function-calls.md:3 @@ -5748,95 +5635,68 @@ msgid "" "While move semantics are the default, certain types are copied by default:" msgstr "" -#: 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 +#: src/ownership/copy-clone.md:15 msgid "These types implement the `Copy` trait." msgstr "" -#: src/ownership/copy-clone.md:16 +#: src/ownership/copy-clone.md:17 msgid "You can opt-in your own types to use copy semantics:" msgstr "" -#: 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 +#: src/ownership/copy-clone.md:32 msgid "After the assignment, both `p1` and `p2` own their own data." msgstr "" -#: src/ownership/copy-clone.md:31 +#: src/ownership/copy-clone.md:33 msgid "We can also use `p1.clone()` to explicitly copy the data." msgstr "" -#: src/ownership/copy-clone.md:35 +#: src/ownership/copy-clone.md:37 msgid "Copying and cloning are not the same thing:" msgstr "" -#: src/ownership/copy-clone.md:37 +#: src/ownership/copy-clone.md:39 msgid "" "Copying refers to bitwise copies of memory regions and does not work on " "arbitrary objects." msgstr "" -#: src/ownership/copy-clone.md:38 +#: src/ownership/copy-clone.md:40 msgid "" "Copying does not allow for custom logic (unlike copy constructors in C++)." msgstr "" -#: src/ownership/copy-clone.md:39 +#: src/ownership/copy-clone.md:41 msgid "" "Cloning is a more general operation and also allows for custom behavior by " "implementing the `Clone` trait." msgstr "" -#: src/ownership/copy-clone.md:40 +#: src/ownership/copy-clone.md:42 msgid "Copying does not work on types that implement the `Drop` trait." msgstr "" -#: src/ownership/copy-clone.md:42 src/ownership/lifetimes-function-calls.md:29 +#: src/ownership/copy-clone.md:44 src/ownership/lifetimes-function-calls.md:30 msgid "In the above example, try the following:" msgstr "" -#: src/ownership/copy-clone.md:44 +#: src/ownership/copy-clone.md:46 msgid "" "Add a `String` field to `struct Point`. It will not compile because `String` " "is not a `Copy` type." msgstr "" -#: src/ownership/copy-clone.md:45 +#: src/ownership/copy-clone.md:47 msgid "" "Remove `Copy` from the `derive` attribute. The compiler error is now in the " "`println!` for `p1`." msgstr "" -#: src/ownership/copy-clone.md:46 +#: src/ownership/copy-clone.md:48 msgid "Show that it works if you clone `p1` instead." msgstr "" -#: src/ownership/copy-clone.md:48 +#: src/ownership/copy-clone.md:50 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 " @@ -5849,38 +5709,19 @@ msgid "" "function _borrow_ the value:" msgstr "" -#: 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 +#: src/ownership/borrowing.md:23 msgid "The `add` function _borrows_ two points and returns a new point." msgstr "" -#: src/ownership/borrowing.md:23 +#: src/ownership/borrowing.md:24 msgid "The caller retains ownership of the inputs." msgstr "" -#: src/ownership/borrowing.md:27 +#: src/ownership/borrowing.md:28 msgid "Notes on stack returns:" msgstr "" -#: src/ownership/borrowing.md:28 +#: src/ownership/borrowing.md:29 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 " @@ -5890,33 +5731,11 @@ msgid "" "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 +#: src/ownership/borrowing.md:50 msgid "The Rust compiler can do return value optimization (RVO)." msgstr "" -#: src/ownership/borrowing.md:49 +#: src/ownership/borrowing.md:51 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 " @@ -5936,37 +5755,19 @@ msgstr "" msgid "You can have exactly one `&mut T` value." msgstr "" -#: 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 +#: src/ownership/shared-unique-borrows.md:26 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 "" -#: src/ownership/shared-unique-borrows.md:26 +#: src/ownership/shared-unique-borrows.md:27 msgid "" "Move the `println!` statement for `b` before the scope that introduces `c` " "to make the code compile." msgstr "" -#: src/ownership/shared-unique-borrows.md:27 +#: src/ownership/shared-unique-borrows.md:28 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 " @@ -5985,7 +5786,7 @@ msgstr "" msgid "Lifetimes can also be explicit: `&'a Point`, `&'document str`." msgstr "" -#: src/ownership/lifetimes.md:7 src/ownership/lifetimes-function-calls.md:23 +#: src/ownership/lifetimes.md:7 src/ownership/lifetimes-function-calls.md:24 msgid "" "Read `&'a Point` as \"a borrowed `Point` which is valid for at least the " "lifetime `a`\"." @@ -6016,93 +5817,52 @@ msgid "" "value:" msgstr "" -#: 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 +#: src/ownership/lifetimes-function-calls.md:22 msgid "`'a` is a generic parameter, it is inferred by the compiler." msgstr "" -#: src/ownership/lifetimes-function-calls.md:22 +#: src/ownership/lifetimes-function-calls.md:23 msgid "Lifetimes start with `'` and `'a` is a typical default name." msgstr "" -#: src/ownership/lifetimes-function-calls.md:25 +#: src/ownership/lifetimes-function-calls.md:26 msgid "" "The _at least_ part is important when parameters are in different scopes." msgstr "" -#: src/ownership/lifetimes-function-calls.md:31 +#: src/ownership/lifetimes-function-calls.md:32 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 +#: src/ownership/lifetimes-function-calls.md:52 msgid "Note how this does not compile since `p3` outlives `p2`." msgstr "" -#: src/ownership/lifetimes-function-calls.md:52 +#: src/ownership/lifetimes-function-calls.md:54 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 +#: src/ownership/lifetimes-function-calls.md:55 msgid "Another way to explain it:" msgstr "" -#: src/ownership/lifetimes-function-calls.md:54 +#: src/ownership/lifetimes-function-calls.md:56 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 +#: src/ownership/lifetimes-function-calls.md:58 msgid "" "It must have come from one of those two inputs (or from a global variable)." msgstr "" -#: src/ownership/lifetimes-function-calls.md:57 +#: src/ownership/lifetimes-function-calls.md:59 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 " @@ -6168,311 +5928,6 @@ msgid "" "of the struct itself. Those are very advanced use cases." msgstr "" -#: src/exercises/day-2/morning.md:1 -msgid "Day 2: Morning Exercises" -msgstr "" - -#: src/exercises/day-2/morning.md:3 -msgid "We will look at implementing methods in two contexts:" -msgstr "" - -#: src/exercises/day-2/morning.md:5 -msgid "Simple struct which tracks health statistics." -msgstr "" - -#: src/exercises/day-2/morning.md:7 -msgid "Multiple structs and enums for a drawing library." -msgstr "" - -#: src/exercises/day-2/book-library.md:3 -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 "" - -#: 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 -msgid "" -"Use this to model a library's book collection. Copy the code below to " -" and update the types to make it compile:" -msgstr "" - -#: 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 -msgid "[Solution](solutions-afternoon.md#designing-a-library)" -msgstr "" - -#: src/exercises/day-2/iterators-and-ownership.md:3 -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 "" - -#: src/exercises/day-2/iterators-and-ownership.md:8 src/bare-metal/no_std.md:28 -msgid "`Iterator`" -msgstr "" - -#: src/exercises/day-2/iterators-and-ownership.md:10 -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 "" - -#: src/exercises/day-2/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-2/iterators-and-ownership.md:20 -msgid "You use this trait like this:" -msgstr "" - -#: 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 -msgid "What is the type returned by the iterator? Test your answer here:" -msgstr "" - -#: 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 -msgid "Why is this type used?" -msgstr "" - -#: src/exercises/day-2/iterators-and-ownership.md:48 -msgid "`IntoIterator`" -msgstr "" - -#: src/exercises/day-2/iterators-and-ownership.md:50 -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 "" - -#: 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 -msgid "" -"The syntax here means that every implementation of `IntoIterator` must " -"declare two types:" -msgstr "" - -#: src/exercises/day-2/iterators-and-ownership.md:65 -msgid "`Item`: the type we iterate over, such as `i8`," -msgstr "" - -#: src/exercises/day-2/iterators-and-ownership.md:66 -msgid "`IntoIter`: the `Iterator` type returned by the `into_iter` method." -msgstr "" - -#: src/exercises/day-2/iterators-and-ownership.md:68 -msgid "" -"Note that `IntoIter` and `Item` are linked: the iterator must have the same " -"`Item` type, which means that it returns `Option`" -msgstr "" - -#: src/exercises/day-2/iterators-and-ownership.md:71 -msgid "Like before, what is the type returned by the iterator?" -msgstr "" - -#: 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 -msgid "`for` Loops" -msgstr "" - -#: src/exercises/day-2/iterators-and-ownership.md:85 -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 "" - -#: 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 -msgid "What is the type of `word` in each loop?" -msgstr "" - -#: src/exercises/day-2/iterators-and-ownership.md:105 -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 "" - #: src/structs.md:3 msgid "Like C and C++, Rust has support for custom structs:" msgstr "" @@ -6530,7 +5985,7 @@ msgstr "" #: src/structs.md:38 msgid "" -"Zero-sized structs `e.g., struct Foo;` might be used when implementing a " +"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 "" @@ -6603,7 +6058,7 @@ msgstr "" #: src/structs/tuple-structs.md:39 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)\\`." +"to validate it again at every use: `PhoneNumber(String)` or `OddNumber(u32)`." msgstr "" #: src/structs/tuple-structs.md:40 @@ -6662,22 +6117,6 @@ msgid "" "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 " @@ -6933,12 +6372,133 @@ msgid "" "over. We describe vectors in more detail in the afternoon. " msgstr "" -#: src/exercises/day-2/afternoon.md:1 -msgid "Day 2: Afternoon Exercises" +#: src/exercises/day-2/morning.md:1 +msgid "Day 2: Morning Exercises" msgstr "" -#: src/exercises/day-2/afternoon.md:3 -msgid "The exercises for this afternoon will focus on strings and iterators." +#: src/exercises/day-2/morning.md:3 +msgid "We will look at implementing methods in two contexts:" +msgstr "" + +#: src/exercises/day-2/morning.md:5 +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 +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 "" + +#: 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 +msgid "" +"Use this to model a library's book collection. Copy the code below to " +" and update the types to make it compile:" +msgstr "" + +#: 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. Notice how the `self` parameter\n" +"// changes type to indicate the method's required level of ownership\n" +"// 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(&mut 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 print 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" +"fn main() {\n" +" let mut library = Library::new();\n" +"\n" +" println!(\n" +" \"The library is empty: library.is_empty() -> {}\",\n" +" library.is_empty()\n" +" );\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!(\n" +" \"The library is no longer empty: library.is_empty() -> {}\",\n" +" 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/health-statistics.md:3 @@ -6988,36 +6548,38 @@ msgid "" "\n" "impl User {\n" " pub fn new(name: String, age: u32, height: f32) -> Self {\n" -" unimplemented!()\n" +" todo!(\"Create a new User instance\")\n" " }\n" "\n" " pub fn name(&self) -> &str {\n" -" unimplemented!()\n" +" todo!(\"Return the user's name\")\n" " }\n" "\n" " pub fn age(&self) -> u32 {\n" -" unimplemented!()\n" +" todo!(\"Return the user's age\")\n" " }\n" "\n" " pub fn height(&self) -> f32 {\n" -" unimplemented!()\n" +" todo!(\"Return the user's height\")\n" " }\n" "\n" " pub fn doctor_visits(&self) -> u32 {\n" -" unimplemented!()\n" +" todo!(\"Return the number of time the user has visited the " +"doctor\")\n" " }\n" "\n" " pub fn set_age(&mut self, new_age: u32) {\n" -" unimplemented!()\n" +" todo!(\"Set the user's age\")\n" " }\n" "\n" " pub fn set_height(&mut self, new_height: f32) {\n" -" unimplemented!()\n" +" todo!(\"Set the user's height\")\n" " }\n" "\n" " pub fn visit_doctor(&mut self, measurements: Measurements) -> " "HealthReport {\n" -" unimplemented!()\n" +" todo!(\"Update a user's statistics based on measurements from a " +"visit to the doctor\")\n" " }\n" "}\n" "\n" @@ -7066,7 +6628,7 @@ msgstr "" #: src/std.md:3 msgid "" "Rust comes with a standard library which helps establish a set of common " -"types used by Rust library and programs. This way, two libraries can work " +"types used by Rust libraries and programs. This way, two libraries can work " "together smoothly because they both use the same `String` type." msgstr "" @@ -7143,8 +6705,8 @@ msgid "" " let first: Option<&i8> = numbers.first();\n" " println!(\"first: {first:?}\");\n" "\n" -" let idx: Result = numbers.binary_search(&10);\n" -" println!(\"idx: {idx:?}\");\n" +" let arr: Result<[i8; 3], Vec> = numbers.try_into();\n" +" println!(\"arr: {arr:?}\");\n" "}\n" "```" msgstr "" @@ -7164,17 +6726,18 @@ msgid "" msgstr "" #: src/std/option-result.md:21 -msgid "`binary_search` returns `Result`." +msgid "" +"`try_into` attempts to convert the vector into a fixed-sized array. This can " +"fail:" msgstr "" #: src/std/option-result.md:22 -msgid "If found, `Result::Ok` holds the index where the element is found." +msgid "" +"If the vector has the right size, `Result::Ok` is returned with the array." msgstr "" #: src/std/option-result.md:23 -msgid "" -"Otherwise, `Result::Err` contains the index where such an element should be " -"inserted." +msgid "Otherwise, `Result::Err` is returned with the original vector." msgstr "" #: src/std/string.md:3 @@ -7249,7 +6812,7 @@ msgid "" msgstr "" #: src/std/string.md:36 -msgid "Write and compare `let s3 = s1.deref();` and `let s3 = &*s1`;." +msgid "Write and compare `let s3 = s1.deref();` and `let s3 = &*s1;`." msgstr "" #: src/std/string.md:37 @@ -7414,7 +6977,7 @@ msgstr "" msgid "" "```rust,ignore\n" " let pc1 = page_counts\n" -" .get(\"Harry Potter and the Sorcerer's Stone \")\n" +" .get(\"Harry Potter and the Sorcerer's Stone\")\n" " .unwrap_or(&336);\n" " let pc2 = page_counts\n" " .entry(\"The Hunger Games\".to_string())\n" @@ -7491,22 +7054,6 @@ msgid "" "```" msgstr "" -#: src/std/box.md:13 -msgid "" -"```bob\n" -" Stack Heap\n" -".- - - - - - -. .- - - - - - -.\n" -": : : :\n" -": five : : :\n" -": +-----+ : : +-----+ :\n" -": | o---|---+-----+-->| 5 | :\n" -": +-----+ : : +-----+ :\n" -": : : :\n" -": : : :\n" -"`- - - - - - -' `- - - - - - -'\n" -"```" -msgstr "" - #: src/std/box.md:26 msgid "" "`Box` implements `Deref`, which means that you can [call " @@ -7953,26 +7500,11 @@ msgid "" "will typically see something like this at the top of each module:" msgstr "" -#: src/modules/paths.md:16 -msgid "" -"```rust,editable\n" -"use std::collections::HashSet;\n" -"use std::mem::transmute;\n" -"```" -msgstr "" - #: src/modules/filesystem.md:3 msgid "" "Omitting the module content will tell Rust to look for it in another file:" msgstr "" -#: src/modules/filesystem.md:5 -msgid "" -"```rust,editable,compile_fail\n" -"mod garden;\n" -"```" -msgstr "" - #: src/modules/filesystem.md:9 msgid "" "This tells rust that the `garden` module content is found at `src/garden." @@ -8034,17 +7566,6 @@ msgstr "" 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" -"├── main.rs\n" -"├── top_module.rs\n" -"└── top_module/\n" -" └── sub_module.rs\n" -"```" -msgstr "" - #: src/modules/filesystem.md:52 msgid "" "The place rust will look for modules can be changed with a compiler " @@ -8065,6 +7586,164 @@ msgid "" "in a file named `some_module_test.rs`, similar to the convention in Go." msgstr "" +#: src/exercises/day-2/afternoon.md:1 +msgid "Day 2: Afternoon Exercises" +msgstr "" + +#: src/exercises/day-2/afternoon.md:3 +msgid "The exercises for this afternoon will focus on strings and iterators." +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:3 +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 "" + +#: src/exercises/day-2/iterators-and-ownership.md:8 src/bare-metal/no_std.md:28 +msgid "`Iterator`" +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:10 +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 "" + +#: src/exercises/day-2/iterators-and-ownership.md:20 +msgid "You use this trait like this:" +msgstr "" + +#: 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 +msgid "What is the type returned by the iterator? Test your answer here:" +msgstr "" + +#: 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 +msgid "Why is this type used?" +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:48 +msgid "`IntoIterator`" +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:50 +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 "" + +#: src/exercises/day-2/iterators-and-ownership.md:62 +msgid "" +"The syntax here means that every implementation of `IntoIterator` must " +"declare two types:" +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:65 +msgid "`Item`: the type we iterate over, such as `i8`," +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:66 +msgid "`IntoIter`: the `Iterator` type returned by the `into_iter` method." +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:68 +msgid "" +"Note that `IntoIter` and `Item` are linked: the iterator must have the same " +"`Item` type, which means that it returns `Option`" +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:71 +msgid "Like before, what is the type returned by the iterator?" +msgstr "" + +#: 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 +msgid "`for` Loops" +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:85 +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 "" + +#: 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 +msgid "What is the type of `word` in each loop?" +msgstr "" + +#: src/exercises/day-2/iterators-and-ownership.md:105 +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 "" + #: src/exercises/day-2/strings-iterators.md:3 msgid "" "In this exercise, you are implementing a routing component of a web server. " @@ -8252,40 +7931,10 @@ msgstr "" msgid "Generic code is turned into non-generic code based on the call sites:" msgstr "" -#: src/generics/monomorphization.md:5 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" let integer = Some(5);\n" -" let float = Some(5.0);\n" -"}\n" -"```" -msgstr "" - #: src/generics/monomorphization.md:12 msgid "behaves as if you wrote" msgstr "" -#: src/generics/monomorphization.md:14 -msgid "" -"```rust,editable\n" -"enum Option_i32 {\n" -" Some(i32),\n" -" None,\n" -"}\n" -"\n" -"enum Option_f64 {\n" -" Some(f64),\n" -" None,\n" -"}\n" -"\n" -"fn main() {\n" -" let integer = Option_i32::Some(5);\n" -" let float = Option_f64::Some(5.0);\n" -"}\n" -"```" -msgstr "" - #: src/generics/monomorphization.md:31 msgid "" "This is a zero-cost abstraction: you get exactly the same result as if you " @@ -8300,39 +7949,32 @@ msgstr "" #: src/traits.md:5 msgid "" "```rust,editable\n" +"struct Dog { name: String, age: i8 }\n" +"struct Cat { lives: i8 } // No name needed, cats won't respond anyway.\n" +"\n" "trait Pet {\n" -" fn name(&self) -> String;\n" +" fn talk(&self) -> String;\n" "}\n" "\n" -"struct Dog {\n" -" name: String,\n" -"}\n" -"\n" -"struct Cat;\n" -"\n" "impl Pet for Dog {\n" -" fn name(&self) -> String {\n" -" self.name.clone()\n" -" }\n" +" fn talk(&self) -> String { format!(\"Woof, my name is {}!\", self." +"name) }\n" "}\n" "\n" "impl Pet for Cat {\n" -" fn name(&self) -> String {\n" -" String::from(\"The cat\") // No name, cats won't respond to it " -"anyway.\n" -" }\n" +" fn talk(&self) -> String { String::from(\"Miau!\") }\n" "}\n" "\n" "fn greet(pet: &P) {\n" -" println!(\"Who's a cutie? {} is!\", pet.name());\n" +" println!(\"Oh you're a cutie! What's your name? {}\", pet.talk());\n" "}\n" "\n" "fn main() {\n" -" let fido = Dog { name: \"Fido\".into() };\n" -" greet(&fido);\n" +" let captain_floof = Cat { lives: 9 };\n" +" let fido = Dog { name: String::from(\"Fido\"), age: 5 };\n" "\n" -" let captain_floof = Cat;\n" " greet(&captain_floof);\n" +" greet(&fido);\n" "}\n" "```" msgstr "" @@ -8346,122 +7988,136 @@ msgstr "" #: src/traits/trait-objects.md:5 msgid "" "```rust,editable\n" +"struct Dog { name: String, age: i8 }\n" +"struct Cat { lives: i8 } // No name needed, cats won't respond anyway.\n" +"\n" "trait Pet {\n" -" fn name(&self) -> String;\n" +" fn talk(&self) -> String;\n" "}\n" "\n" -"struct Dog {\n" -" name: String,\n" -"}\n" -"\n" -"struct Cat;\n" -"\n" "impl Pet for Dog {\n" -" fn name(&self) -> String {\n" -" self.name.clone()\n" -" }\n" +" fn talk(&self) -> String { format!(\"Woof, my name is {}!\", self." +"name) }\n" "}\n" "\n" "impl Pet for Cat {\n" -" fn name(&self) -> String {\n" -" String::from(\"The cat\") // No name, cats won't respond to it " -"anyway.\n" -" }\n" +" fn talk(&self) -> String { String::from(\"Miau!\") }\n" "}\n" "\n" "fn main() {\n" " let pets: Vec> = vec![\n" -" Box::new(Cat),\n" -" Box::new(Dog { name: String::from(\"Fido\") }),\n" +" Box::new(Cat { lives: 9 }),\n" +" Box::new(Dog { name: String::from(\"Fido\"), age: 5 }),\n" " ];\n" " for pet in pets {\n" -" println!(\"Hello {}!\", pet.name());\n" +" println!(\"Hello, who are you? {}\", pet.talk());\n" " }\n" "}\n" "```" msgstr "" -#: src/traits/trait-objects.md:40 +#: src/traits/trait-objects.md:32 msgid "Memory layout after allocating `pets`:" msgstr "" -#: src/traits/trait-objects.md:42 +#: src/traits/trait-objects.md:34 msgid "" "```bob\n" " Stack Heap\n" ".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - " "- -.\n" ": : : :\n" -": " -"pets : : :\n" -": +-----------+-------+ : : +-----+-----" -"+ :\n" -": | ptr | o---+---+-----+-->| o o | o o " -"| :\n" -": | len | 2 | : : +-|-|-+-|-|-" -"+ :\n" -": | capacity | 2 | : : | | | | +---------------" -"+ :\n" -": +-----------+-------+ : : | | | '-->| name: \"Fido\" " -"| :\n" -": : : | | | +---------------" -"+ :\n" -"`- - - - - - - - - - - - - -' : | | " +": pets : : +----+----+----+----" +"+ :\n" +": +-----------+-------+ : : +-----+-----+ .->| F | i | d | o " +"| :\n" +": | ptr | o---+---+-----+-->| o o | o o | | +----+----+----+----" +"+ :\n" +": | len | 2 | : : +-|-|-+-|-|-+ " +"`---------. :\n" +": | capacity | 2 | : : | | | | data " +"| :\n" +": +-----------+-------+ : : | | | | +-------+--|-------" +"+ :\n" +": : : | | | '-->| name | o, 4, 4 " +"| :\n" +": : : | | | | age | 5 " +"| :\n" +"`- - - - - - - - - - - - - -' : | | | +-------+----------" +"+ :\n" +" : | | " "| :\n" +" : | | | " +"vtable :\n" " : | | | +----------------------" -"+ : \n" -" : | | '---->| \"::name\" " +"+ :\n" +" : | | '---->| \"::talk\" " "| :\n" " : | | +----------------------" -"+ : \n" +"+ :\n" " : | " -"| : \n" -" : | | +-" -"+ : \n" -" : | '-->|" -"\\| : \n" -" : | +-" -"+ : \n" +"| :\n" +" : | | " +"data :\n" +" : | | +-------+-------" +"+ :\n" +" : | '-->| lives | 9 " +"| :\n" +" : | +-------+-------" +"+ :\n" " : " -"| : \n" +"| :\n" +" : | " +"vtable :\n" " : | +----------------------" -"+ : \n" -" : '---->| \"::name\" " -"| : \n" +"+ :\n" +" : '---->| \"::talk\" " +"| :\n" " : +----------------------" "+ :\n" " : :\n" " '- - - - - - - - - - - - - - - - - - - - - " "- -'\n" -"\n" "```" msgstr "" -#: src/traits/trait-objects.md:72 +#: src/traits/trait-objects.md:68 msgid "" "Types that implement a given trait may be of different sizes. This makes it " -"impossible to have things like `Vec` in the example above." +"impossible to have things like `Vec` in the example above." msgstr "" -#: src/traits/trait-objects.md:73 +#: src/traits/trait-objects.md:70 msgid "" "`dyn Pet` is a way to tell the compiler about a dynamically sized type that " "implements `Pet`." msgstr "" -#: src/traits/trait-objects.md:74 +#: src/traits/trait-objects.md:72 msgid "" -"In the example, `pets` holds _fat pointers_ to objects that implement `Pet`. " -"The fat pointer consists of two components, a pointer to the actual object " -"and a pointer to the virtual method table for the `Pet` implementation of " -"that particular object." +"In the example, `pets` is allocated on the stack and the vector data is on " +"the heap. The two vector elements are _fat pointers_:" msgstr "" -#: src/traits/trait-objects.md:75 +#: src/traits/trait-objects.md:74 +msgid "" +"A fat pointer is a double-width pointer. It has two components: a pointer to " +"the actual object and a pointer to the [virtual method table](https://en." +"wikipedia.org/wiki/Virtual_method_table) (vtable) for the `Pet` " +"implementation of that particular object." +msgstr "" + +#: src/traits/trait-objects.md:77 +msgid "" +"The data for the `Dog` named Fido is the `name` and `age` fields. The `Cat` " +"has a `lives` field." +msgstr "" + +#: src/traits/trait-objects.md:79 msgid "Compare these outputs in the above example:" msgstr "" -#: src/traits/trait-objects.md:76 +#: src/traits/trait-objects.md:80 msgid "" "```rust,ignore\n" " println!(\"{} {}\", std::mem::size_of::(), std::mem::size_of::" @@ -8549,36 +8205,10 @@ msgstr "" msgid "Make `Equals` a super trait for `NotEquals`." msgstr "" -#: src/traits/default-methods.md:38 -msgid "" -"```rust,editable,compile_fail\n" -"trait NotEquals: Equals {\n" -" fn not_equals(&self, other: &Self) -> bool {\n" -" !self.equals(other)\n" -" }\n" -"}\n" -"```" -msgstr "" - #: src/traits/default-methods.md:46 msgid "Provide a blanket implementation of `NotEquals` for `Equals`." msgstr "" -#: src/traits/default-methods.md:47 -msgid "" -"```rust,editable,compile_fail\n" -"trait NotEquals {\n" -" fn not_equals(&self, other: &Self) -> bool;\n" -"}\n" -"\n" -"impl NotEquals for T where T: Equals {\n" -" fn not_equals(&self, other: &Self) -> bool {\n" -" !self.equals(other)\n" -" }\n" -"}\n" -"```" -msgstr "" - #: src/traits/default-methods.md:58 msgid "" "With the blanket implementation, you no longer need `Equals` as a super " @@ -8627,18 +8257,6 @@ msgstr "" msgid "Show a `where` clause, students will encounter it when reading code." msgstr "" -#: src/traits/trait-bounds.md:37 -msgid "" -"```rust,ignore\n" -"fn duplicate(a: T) -> (T, T)\n" -"where\n" -" T: Clone,\n" -"{\n" -" (a.clone(), a.clone())\n" -"}\n" -"```" -msgstr "" - #: src/traits/trait-bounds.md:46 msgid "It declutters the function signature if you have many parameters." msgstr "" @@ -8838,17 +8456,18 @@ msgid "" " .into_iter()\n" " .map(|prime| prime * prime)\n" " .collect::>();\n" +" println!(\"prime_squares: {prime_squares:?}\");\n" "}\n" "```" msgstr "" -#: src/traits/from-iterator.md:17 +#: src/traits/from-iterator.md:18 msgid "" "`Iterator` implements `fn collect(self) -> B where B: FromIterator, Self: Sized`" msgstr "" -#: src/traits/from-iterator.md:23 +#: src/traits/from-iterator.md:24 msgid "" "There are also implementations which let you do cool things like convert an " "`Iterator>` into a `Result, E>`." @@ -9010,21 +8629,54 @@ msgid "" "```" msgstr "" -#: src/traits/drop.md:34 src/traits/operators.md:26 -msgid "Discussion points:" +#: src/traits/drop.md:34 +msgid "Note that `std::mem::drop` is not the same as `std::ops::Drop::drop`." +msgstr "" + +#: src/traits/drop.md:35 +msgid "Values are automatically dropped when they go out of scope." msgstr "" #: src/traits/drop.md:36 +msgid "" +"When a value is dropped, if it implements `std::ops::Drop` then its `Drop::" +"drop` implementation will be called." +msgstr "" + +#: src/traits/drop.md:38 +msgid "" +"All its fields will then be dropped too, whether or not it implements `Drop`." +msgstr "" + +#: src/traits/drop.md:39 +msgid "" +"`std::mem::drop` is just an empty function that takes any value. The " +"significance is that it takes ownership of the value, so at the end of its " +"scope it gets dropped. This makes it a convenient way to explicitly drop " +"values earlier than they would otherwise go out of scope." +msgstr "" + +#: src/traits/drop.md:42 +msgid "" +"This can be useful for objects that do some work on `drop`: releasing locks, " +"closing files, etc." +msgstr "" + +#: src/traits/drop.md:45 src/traits/operators.md:26 +msgid "Discussion points:" +msgstr "" + +#: src/traits/drop.md:47 msgid "Why doesn't `Drop::drop` take `self`?" msgstr "" -#: src/traits/drop.md:37 +#: src/traits/drop.md:48 msgid "" "Short-answer: If it did, `std::mem::drop` would be called at the end of the " "block, resulting in another call to `Drop::drop`, and a stack overflow!" msgstr "" -#: src/traits/drop.md:40 +#: src/traits/drop.md:51 msgid "Try replacing `drop(a)` with `a.drop()`." msgstr "" @@ -9280,10 +8932,16 @@ msgid "" "polygons." msgstr "" +#: src/exercises/day-3/simple-gui.md:1 +#: src/exercises/day-3/solutions-morning.md:3 +msgid "Drawing A Simple GUI" +msgstr "Basit Bir GUI Çizimi" + #: src/exercises/day-3/simple-gui.md:3 msgid "" "Let us design a classical GUI library using our new knowledge of traits and " -"trait objects." +"trait objects. We'll only implement the drawing of it (as text) for " +"simplicity." msgstr "" #: src/exercises/day-3/simple-gui.md:6 @@ -9296,25 +8954,26 @@ msgstr "" #: src/exercises/day-3/simple-gui.md:9 msgid "" -"`Button`: has a `label` and a callback function which is invoked when the " -"button is pressed." +"`Button`: has a `label`. In reality, it would also take a callback function " +"to allow the program to do something when the button is clicked but we won't " +"include that since we're only drawing the GUI." msgstr "" -#: src/exercises/day-3/simple-gui.md:11 +#: src/exercises/day-3/simple-gui.md:12 msgid "`Label`: has a `label`." msgstr "" -#: src/exercises/day-3/simple-gui.md:13 +#: src/exercises/day-3/simple-gui.md:14 msgid "The widgets will implement a `Widget` trait, see below." msgstr "" -#: src/exercises/day-3/simple-gui.md:15 +#: src/exercises/day-3/simple-gui.md:16 msgid "" "Copy the code below to , fill in the missing " "`draw_into` methods so that you implement the `Widget` trait:" msgstr "" -#: src/exercises/day-3/simple-gui.md:18 +#: src/exercises/day-3/simple-gui.md:19 msgid "" "```rust,should_panic\n" "// TODO: remove this when you're done with your implementation.\n" @@ -9349,14 +9008,12 @@ msgid "" "\n" "pub struct Button {\n" " label: Label,\n" -" callback: Box,\n" "}\n" "\n" "impl Button {\n" -" fn new(label: &str, callback: Box) -> Button {\n" +" fn new(label: &str) -> Button {\n" " Button {\n" " label: Label::new(label),\n" -" callback,\n" " }\n" " }\n" "}\n" @@ -9422,32 +9079,18 @@ msgid "" " window.add_widget(Box::new(Label::new(\"This is a small text GUI demo." "\")));\n" " window.add_widget(Box::new(Button::new(\n" -" \"Click me!\",\n" -" Box::new(|| println!(\"You clicked the button!\")),\n" +" \"Click me!\"\n" " )));\n" " window.draw();\n" "}\n" "```" msgstr "" -#: src/exercises/day-3/simple-gui.md:130 +#: src/exercises/day-3/simple-gui.md:128 msgid "The output of the above program can be something simple like this:" msgstr "" -#: src/exercises/day-3/simple-gui.md:132 -msgid "" -"```text\n" -"========\n" -"Rust GUI Demo 1.23\n" -"========\n" -"\n" -"This is a small text GUI demo.\n" -"\n" -"| Click me! |\n" -"```" -msgstr "" - -#: src/exercises/day-3/simple-gui.md:142 +#: src/exercises/day-3/simple-gui.md:140 msgid "" "If you want to draw aligned text, you can use the [fill/alignment](https://" "doc.rust-lang.org/std/fmt/index.html#fillalignment) formatting operators. In " @@ -9455,7 +9098,7 @@ msgid "" "and how you can control alignment:" msgstr "" -#: src/exercises/day-3/simple-gui.md:147 +#: src/exercises/day-3/simple-gui.md:145 msgid "" "```rust,editable\n" "fn main() {\n" @@ -9467,25 +9110,11 @@ msgid "" "```" msgstr "" -#: src/exercises/day-3/simple-gui.md:156 +#: src/exercises/day-3/simple-gui.md:154 msgid "" "Using such alignment tricks, you can for example produce output like this:" msgstr "" -#: src/exercises/day-3/simple-gui.md:158 -msgid "" -"```text\n" -"+--------------------------------+\n" -"| Rust GUI Demo 1.23 |\n" -"+================================+\n" -"| This is a small text GUI demo. |\n" -"| +-----------+ |\n" -"| | Click me! | |\n" -"| +-----------+ |\n" -"+--------------------------------+\n" -"```" -msgstr "" - #: src/exercises/day-3/points-polygons.md:1 msgid "Polygon Struct" msgstr "" @@ -9687,14 +9316,14 @@ msgid "" "\n" "fn main() {\n" " let result = panic::catch_unwind(|| {\n" -" println!(\"hello!\");\n" +" \"No problem here!\"\n" " });\n" -" assert!(result.is_ok());\n" -" \n" +" println!(\"{result:?}\");\n" +"\n" " let result = panic::catch_unwind(|| {\n" " panic!(\"oh no!\");\n" " });\n" -" assert!(result.is_err());\n" +" println!(\"{result:?}\");\n" "}\n" "```" msgstr "" @@ -9766,27 +9395,10 @@ msgid "" "turn the common" msgstr "" -#: src/error-handling/try-operator.md:6 -msgid "" -"```rust,ignore\n" -"match some_expression {\n" -" Ok(value) => value,\n" -" Err(err) => return Err(err),\n" -"}\n" -"```" -msgstr "" - #: src/error-handling/try-operator.md:13 msgid "into the much simpler" msgstr "" -#: src/error-handling/try-operator.md:15 -msgid "" -"```rust,ignore\n" -"some_expression?\n" -"```" -msgstr "" - #: src/error-handling/try-operator.md:19 msgid "We can use this to simplify our error handling code:" msgstr "" @@ -9855,27 +9467,10 @@ msgid "" "indicated:" msgstr "" -#: src/error-handling/converting-error-types.md:5 -msgid "" -"```rust,ignore\n" -"expression?\n" -"```" -msgstr "" - #: src/error-handling/converting-error-types.md:9 msgid "works the same as" msgstr "" -#: src/error-handling/converting-error-types.md:11 -msgid "" -"```rust,ignore\n" -"match expression {\n" -" Ok(value) => value,\n" -" Err(err) => return Err(From::from(err)),\n" -"}\n" -"```" -msgstr "" - #: src/error-handling/converting-error-types.md:18 msgid "" "The `From::from` call here means we attempt to convert the error type to the " @@ -10197,7 +9792,7 @@ msgid "" "/// Shortens a string to the given length.\n" "///\n" "/// ```\n" -"/// use playground::shorten_string;\n" +"/// # use playground::shorten_string;\n" "/// assert_eq!(shorten_string(\"Hello World\", 5), \"Hello\");\n" "/// assert_eq!(shorten_string(\"Hello World\", 20), \"Hello World\");\n" "/// ```\n" @@ -10217,6 +9812,12 @@ msgstr "" #: src/testing/doc-tests.md:20 msgid "" +"Adding `# ` in the code will hide it from the docs, but will still compile/" +"run it." +msgstr "" + +#: src/testing/doc-tests.md:21 +msgid "" "Test the above code on the [Rust Playground](https://play.rust-lang.org/?" "version=stable&mode=debug&edition=2021&gist=3ce2ad13ea1302f6572cb15cd96becf0)." msgstr "" @@ -10229,18 +9830,6 @@ msgstr "" msgid "Create a `.rs` file under `tests/`:" msgstr "" -#: src/testing/integration-tests.md:7 -msgid "" -"```rust,ignore\n" -"use my_library::init;\n" -"\n" -"#[test]\n" -"fn test_init() {\n" -" assert!(init().is_ok());\n" -"}\n" -"```" -msgstr "" - #: src/testing/integration-tests.md:16 msgid "These tests only have access to the public API of your crate." msgstr "" @@ -10447,6 +10036,14 @@ msgstr "" #: src/unsafe/mutable-static-variables.md:32 msgid "" +"The program here is safe because it is single-threaded. However, the Rust " +"compiler is conservative and will assume the worst. Try removing the " +"`unsafe` and see how the compiler explains that it is undefined behavior to " +"mutate a static from multiple threads." +msgstr "" + +#: src/unsafe/mutable-static-variables.md:36 +msgid "" "Using a mutable static is generally a bad idea, but there are some cases " "where it might make sense in low-level `no_std` code, such as implementing a " "heap allocator or working with some C APIs." @@ -10518,7 +10115,7 @@ msgid "" "}\n" "\n" "fn count_chars(s: &str) -> usize {\n" -" s.chars().map(|_| 1).sum()\n" +" s.chars().count()\n" "}\n" "```" msgstr "" @@ -10690,7 +10287,7 @@ msgstr "" msgid "" "Rust has great support for calling functions through a _foreign function " "interface_ (FFI). We will use this to build a safe wrapper for the `libc` " -"functions you would use from C to read the filenames of a directory." +"functions you would use from C to read the names of files in a directory." msgstr "" #: src/exercises/day-3/safe-ffi-wrapper.md:7 @@ -10789,7 +10386,7 @@ msgstr "" #: src/exercises/day-3/safe-ffi-wrapper.md:27 msgid "" "`&CStr` to `&[u8]`: a slice of bytes is the universal interface for \"some " -"unknow data\"," +"unknown data\"," msgstr "" #: src/exercises/day-3/safe-ffi-wrapper.md:28 @@ -10948,15 +10545,6 @@ msgid "" "have access to one or create a new one with:" 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" -"```" -msgstr "" - #: src/android/setup.md:12 msgid "" "Please see the [Android Developer Codelab](https://source.android.com/docs/" @@ -11105,13 +10693,6 @@ msgid "" "```" msgstr "" -#: src/android/build-rules/binary.md:35 -msgid "" -"```text\n" -"Hello from Rust!\n" -"```" -msgstr "" - #: src/android/build-rules/library.md:1 msgid "Rust Libraries" msgstr "" @@ -11202,14 +10783,6 @@ msgid "" "```" msgstr "" -#: src/android/build-rules/library.md:67 -msgid "" -"```text\n" -"Hello Bob, it is very\n" -"nice to meet you!\n" -"```" -msgstr "" - #: src/android/aidl.md:3 msgid "" "The [Android Interface Definition Language (AIDL)](https://developer.android." @@ -11237,19 +10810,6 @@ msgid "" "_birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl_:" msgstr "" -#: src/android/aidl/interface.md:7 -msgid "" -"```java\n" -"package com.example.birthdayservice;\n" -"\n" -"/** Birthday service interface. */\n" -"interface IBirthdayService {\n" -" /** Generate a Happy Birthday message. */\n" -" String wishHappyBirthday(String name, int years);\n" -"}\n" -"```" -msgstr "" - #: src/android/aidl/interface.md:17 msgid "_birthday_service/aidl/Android.bp_:" msgstr "" @@ -11406,46 +10966,10 @@ msgstr "" msgid "In another terminal, check that the service runs:" msgstr "" -#: src/android/aidl/deploy.md:13 -msgid "" -"```shell\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:21 msgid "You can also call the service with `service call`:" msgstr "" -#: src/android/aidl/deploy.md:23 -msgid "" -"```shell\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" -" 0x00000020: 00790061 00420020 0062006f 0020002c 'a.y. .B.o.b.,. .'\n" -" 0x00000030: 006f0063 0067006e 00610072 00750074 'c.o.n.g.r.a.t.u.'\n" -" 0x00000040: 0061006c 00690074 006e006f 00200073 'l.a.t.i.o.n.s. .'\n" -" 0x00000050: 00690077 00680074 00740020 00650068 'w.i.t.h. .t.h.e.'\n" -" 0x00000060: 00320020 00200034 00650079 00720061 ' .2.4. .y.e.a.r.'\n" -" 0x00000070: 00210073 00000000 's.!..... ')\n" -"```" -msgstr "" - #: src/android/aidl/client.md:1 msgid "AIDL Client" msgstr "" @@ -11528,32 +11052,12 @@ msgid "" "```" msgstr "" -#: src/android/aidl/client.md:62 -msgid "" -"```text\n" -"Happy Birthday Charlie, congratulations with the 60 years!\n" -"```" -msgstr "" - #: src/android/aidl/changing.md:3 msgid "" "Let us extend the API with more functionality: we want to let clients " "specify a list of lines for the birthday card:" msgstr "" -#: src/android/aidl/changing.md:6 -msgid "" -"```java\n" -"package com.example.birthdayservice;\n" -"\n" -"/** Birthday service interface. */\n" -"interface IBirthdayService {\n" -" /** Generate a Happy Birthday message. */\n" -" String wishHappyBirthday(String name, int years, in String[] text);\n" -"}\n" -"```" -msgstr "" - #: src/android/logging.md:3 msgid "" "You should use the `log` crate to automatically log to `logcat` (on-device) " @@ -11625,24 +11129,6 @@ msgstr "" msgid "The logs show up in `adb logcat`:" msgstr "" -#: src/android/logging.md:52 -msgid "" -"```shell\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" -"09-08 08:38:32.454 2420 2420 E rust: hello_rust_logs: Something went " -"wrong!\n" -"```" -msgstr "" - #: src/android/interoperability.md:3 msgid "" "Rust has excellent support for interoperability with other languages. This " @@ -11726,18 +11212,6 @@ msgstr "" msgid "_interoperability/bindgen/libbirthday.h_:" msgstr "" -#: src/android/interoperability/with-c/bindgen.md:10 -msgid "" -"```c\n" -"typedef struct card {\n" -" const char* name;\n" -" int years;\n" -"} card;\n" -"\n" -"void print_card(const card* card);\n" -"```" -msgstr "" - #: src/android/interoperability/with-c/bindgen.md:19 msgid "_interoperability/bindgen/libbirthday.c_:" msgstr "" @@ -11880,13 +11354,6 @@ msgid "" "```" msgstr "" -#: src/android/interoperability/with-c/bindgen.md:122 -msgid "" -"```shell\n" -"atest libbirthday_bindgen_test\n" -"```" -msgstr "" - #: src/android/interoperability/with-c/rust.md:1 msgid "Calling Rust" msgstr "" @@ -12160,15 +11627,6 @@ msgstr "" msgid "Finally, you can build, sync, and run the binary:" msgstr "" -#: 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" -"```" -msgstr "" - #: src/exercises/android/morning.md:3 msgid "" "This is a group exercise: We will look at one of the projects you work with " @@ -12237,50 +11695,15 @@ msgid "" "To get started, install some tools we'll need later. On gLinux or Debian:" msgstr "" -#: src/bare-metal.md:22 -msgid "" -"```bash\n" -"sudo apt install gcc-aarch64-linux-gnu gdb-multiarch libudev-dev picocom pkg-" -"config qemu-system-arm\n" -"rustup update\n" -"rustup target add aarch64-unknown-none thumbv7em-none-eabihf\n" -"rustup component add llvm-tools-preview\n" -"cargo install cargo-binutils cargo-embed\n" -"```" -msgstr "" - #: src/bare-metal.md:30 msgid "" "And give users in the `plugdev` group access to the micro:bit programmer:" msgstr "" -#: src/bare-metal.md:32 -msgid "" -"```bash\n" -"echo 'SUBSYSTEM==\"usb\", ATTR{idVendor}==\"0d28\", MODE=\"0664\", " -"GROUP=\"plugdev\"' |\\\n" -" sudo tee /etc/udev/rules.d/50-microbit.rules\n" -"sudo udevadm control --reload-rules\n" -"```" -msgstr "" - -#: src/bare-metal.md:38 +#: src/bare-metal.md:38 src/bare-metal/microcontrollers/debugging.md:27 msgid "On MacOS:" msgstr "" -#: src/bare-metal.md:40 -msgid "" -"```bash\n" -"xcode-select --install\n" -"brew install gdb picocom qemu\n" -"brew install --cask gcc-aarch64-embedded\n" -"rustup update\n" -"rustup target add aarch64-unknown-none thumbv7em-none-eabihf\n" -"rustup component add llvm-tools-preview\n" -"cargo install cargo-binutils cargo-embed\n" -"```" -msgstr "" - #: src/bare-metal/no_std.md:1 msgid "`no_std`" msgstr "" @@ -12393,21 +11816,6 @@ msgstr "" msgid "A minimal `no_std` program" msgstr "" -#: src/bare-metal/minimal.md:3 -msgid "" -"```rust,editable,compile_fail\n" -"#![no_main]\n" -"#![no_std]\n" -"\n" -"use core::panic::PanicInfo;\n" -"\n" -"#[panic_handler]\n" -"fn panic(_panic: &PanicInfo) -> ! {\n" -" loop {}\n" -"}\n" -"```" -msgstr "" - #: src/bare-metal/minimal.md:17 msgid "This will compile to an empty binary." msgstr "" @@ -12510,25 +11918,6 @@ msgid "" "Cortex M microcontrollers." msgstr "" -#: src/bare-metal/microcontrollers.md:5 -msgid "" -"```rust,editable,compile_fail\n" -"#![no_main]\n" -"#![no_std]\n" -"\n" -"extern crate panic_halt as _;\n" -"\n" -"mod interrupts;\n" -"\n" -"use cortex_m_rt::entry;\n" -"\n" -"#[entry]\n" -"fn main() -> ! {\n" -" loop {}\n" -"}\n" -"```" -msgstr "" - #: src/bare-metal/microcontrollers.md:21 msgid "" "Next we'll look at how to access peripherals, with increasing levels of " @@ -12629,13 +12018,6 @@ msgstr "" msgid "Run the example with:" msgstr "" -#: src/bare-metal/microcontrollers/mmio.md:68 -msgid "" -"```sh\n" -"cargo embed --bin mmio\n" -"```" -msgstr "" - #: src/bare-metal/microcontrollers/pacs.md:1 msgid "Peripheral Access Crates" msgstr "" @@ -12719,13 +12101,6 @@ msgid "" "pac -- -d --no-show-raw-insn` to see the resulting binary." msgstr "" -#: src/bare-metal/microcontrollers/pacs.md:61 -msgid "" -"```sh\n" -"cargo embed --bin pac\n" -"```" -msgstr "" - #: src/bare-metal/microcontrollers/hals.md:1 msgid "HAL crates" msgstr "" @@ -12782,13 +12157,6 @@ msgid "" "STM32, GD32, nRF, NXP, MSP430, AVR and PIC microcontrollers." msgstr "" -#: src/bare-metal/microcontrollers/hals.md:45 -msgid "" -"```sh\n" -"cargo embed --bin hal\n" -"```" -msgstr "" - #: src/bare-metal/microcontrollers/board-support.md:1 msgid "Board support crates" msgstr "" @@ -12799,30 +12167,6 @@ msgid "" "board for convenience." msgstr "" -#: src/bare-metal/microcontrollers/board-support.md:5 -msgid "" -"```rust,editable,compile_fail\n" -"#![no_main]\n" -"#![no_std]\n" -"\n" -"extern crate panic_halt as _;\n" -"\n" -"use cortex_m_rt::entry;\n" -"use microbit::hal::prelude::*;\n" -"use microbit::Board;\n" -"\n" -"#[entry]\n" -"fn main() -> ! {\n" -" let mut board = Board::take().unwrap();\n" -"\n" -" board.display_pins.col1.set_low().unwrap();\n" -" board.display_pins.row1.set_high().unwrap();\n" -"\n" -" loop {}\n" -"}\n" -"```" -msgstr "" - #: src/bare-metal/microcontrollers/board-support.md:28 msgid "" "In this case the board support crate is just providing more useful names, " @@ -12839,13 +12183,6 @@ msgstr "" msgid "`microbit-v2` includes a simple driver for the LED matrix." msgstr "" -#: src/bare-metal/microcontrollers/board-support.md:36 -msgid "" -"```sh\n" -"cargo embed --bin board_support\n" -"```" -msgstr "" - #: src/bare-metal/microcontrollers/type-state.md:1 msgid "The type state pattern" msgstr "" @@ -12978,23 +12315,12 @@ msgid "" msgstr "" #: src/bare-metal/microcontrollers/probe-rs.md:6 -msgid "SWD" -msgstr "" - -#: src/bare-metal/microcontrollers/probe-rs.md:6 -msgid " and JTAG via CMSIS-DAP, ST-Link and J-Link probes" +msgid "" +"SWD (Serial Wire Debug) and JTAG via CMSIS-DAP, ST-Link and J-Link probes" msgstr "" #: src/bare-metal/microcontrollers/probe-rs.md:7 -msgid "GDB stub and Microsoft " -msgstr "" - -#: src/bare-metal/microcontrollers/probe-rs.md:7 -msgid "DAP" -msgstr "" - -#: src/bare-metal/microcontrollers/probe-rs.md:7 -msgid " server" +msgid "GDB stub and Microsoft DAP (Debug Adapter Protocol) server" msgstr "" #: src/bare-metal/microcontrollers/probe-rs.md:8 @@ -13002,17 +12328,10 @@ msgid "Cargo integration" msgstr "" #: src/bare-metal/microcontrollers/probe-rs.md:10 -msgid "`cargo-embed` is a cargo subcommand to build and flash binaries, log " -msgstr "" - -#: src/bare-metal/microcontrollers/probe-rs.md:11 -msgid "RTT" -msgstr "" - -#: src/bare-metal/microcontrollers/probe-rs.md:11 msgid "" -" output and connect GDB. It's configured by an `Embed.toml` file in your " -"project directory." +"`cargo-embed` is a cargo subcommand to build and flash binaries, log RTT " +"(Real Time Transfers) output and connect GDB. It's configured by an `Embed." +"toml` file in your project directory." msgstr "" #: src/bare-metal/microcontrollers/probe-rs.md:16 @@ -13059,59 +12378,25 @@ msgid "" msgstr "" #: src/bare-metal/microcontrollers/debugging.md:3 -msgid "Embed.toml:" -msgstr "" - -#: src/bare-metal/microcontrollers/debugging.md:5 -msgid "" -"```toml\n" -"[default.general]\n" -"chip = \"nrf52833_xxAA\"\n" -"\n" -"[debug.gdb]\n" -"enabled = true\n" -"```" +msgid "_Embed.toml_:" msgstr "" #: src/bare-metal/microcontrollers/debugging.md:13 msgid "In one terminal under `src/bare-metal/microcontrollers/examples/`:" msgstr "" -#: src/bare-metal/microcontrollers/debugging.md:15 -msgid "" -"```sh\n" -"cargo embed --bin board_support debug\n" -"```" -msgstr "" - #: src/bare-metal/microcontrollers/debugging.md:19 msgid "In another terminal in the same directory:" msgstr "" #: src/bare-metal/microcontrollers/debugging.md:21 -msgid "" -"```sh\n" -"gdb-multiarch target/thumbv7em-none-eabihf/debug/board_support --eval-" -"command=\"target remote :1337\"\n" -"```" +msgid "On gLinux or Debian:" msgstr "" -#: src/bare-metal/microcontrollers/debugging.md:27 +#: src/bare-metal/microcontrollers/debugging.md:34 msgid "In GDB, try running:" msgstr "" -#: src/bare-metal/microcontrollers/debugging.md:29 -msgid "" -"```gdb\n" -"b src/bin/board_support.rs:29\n" -"b src/bin/board_support.rs:30\n" -"b src/bin/board_support.rs:32\n" -"c\n" -"c\n" -"c\n" -"```" -msgstr "" - #: src/bare-metal/microcontrollers/other-projects.md:1 #: src/bare-metal/aps/other-projects.md:1 msgid "Other projects" @@ -13259,7 +12544,7 @@ msgid "" msgstr "" #: src/exercises/bare-metal/compass.md:26 src/exercises/bare-metal/rtc.md:19 -msgid "`src/main.rs`:" +msgid "_src/main.rs_:" msgstr "" #: src/exercises/bare-metal/compass.md:30 @@ -13300,85 +12585,26 @@ msgid "" msgstr "" #: src/exercises/bare-metal/compass.md:64 src/exercises/bare-metal/rtc.md:385 -msgid "`Cargo.toml` (you shouldn't need to change this):" -msgstr "" - -#: src/exercises/bare-metal/compass.md:68 -msgid "" -"```toml\n" -"[workspace]\n" -"\n" -"[package]\n" -"name = \"compass\"\n" -"version = \"0.1.0\"\n" -"edition = \"2021\"\n" -"publish = false\n" -"\n" -"[dependencies]\n" -"cortex-m-rt = \"0.7.3\"\n" -"embedded-hal = \"0.2.6\"\n" -"lsm303agr = \"0.2.2\"\n" -"microbit-v2 = \"0.13.0\"\n" -"panic-halt = \"0.2.0\"\n" -"```" +msgid "_Cargo.toml_ (you shouldn't need to change this):" msgstr "" #: src/exercises/bare-metal/compass.md:85 -msgid "`Embed.toml` (you shouldn't need to change this):" -msgstr "" - -#: src/exercises/bare-metal/compass.md:89 -msgid "" -"```toml\n" -"[default.general]\n" -"chip = \"nrf52833_xxAA\"\n" -"\n" -"[debug.gdb]\n" -"enabled = true\n" -"\n" -"[debug.reset]\n" -"halt_afterwards = true\n" -"```" +msgid "_Embed.toml_ (you shouldn't need to change this):" msgstr "" #: src/exercises/bare-metal/compass.md:100 src/exercises/bare-metal/rtc.md:985 -msgid "`.cargo/config.toml` (you shouldn't need to change this):" -msgstr "" - -#: src/exercises/bare-metal/compass.md:104 -msgid "" -"```toml\n" -"[build]\n" -"target = \"thumbv7em-none-eabihf\" # Cortex-M4F\n" -"\n" -"[target.'cfg(all(target_arch = \"arm\", target_os = \"none\"))']\n" -"rustflags = [\"-C\", \"link-arg=-Tlink.x\"]\n" -"```" +msgid "_.cargo/config.toml_ (you shouldn't need to change this):" msgstr "" #: src/exercises/bare-metal/compass.md:112 msgid "See the serial output on Linux with:" msgstr "" -#: src/exercises/bare-metal/compass.md:114 -msgid "" -"```sh\n" -"picocom --baud 115200 --imap lfcrlf /dev/ttyACM0\n" -"```" -msgstr "" - #: src/exercises/bare-metal/compass.md:118 msgid "" "Or on Mac OS something like (the device name may be slightly different):" msgstr "" -#: src/exercises/bare-metal/compass.md:120 -msgid "" -"```sh\n" -"picocom --baud 115200 --imap lfcrlf /dev/tty.usbmodem14502\n" -"```" -msgstr "" - #: src/exercises/bare-metal/compass.md:124 msgid "Use Ctrl+A Ctrl+Q to quit picocom." msgstr "" @@ -13529,7 +12755,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, " @@ -13564,15 +12790,8 @@ msgstr "" #: src/bare-metal/aps/inline-assembly.md:3 msgid "" "Sometimes we need to use assembly to do things that aren't possible with " -"Rust code. For example, to make an " -msgstr "" - -#: src/bare-metal/aps/inline-assembly.md:4 -msgid "HVC" -msgstr "" - -#: src/bare-metal/aps/inline-assembly.md:4 -msgid " to tell the firmware to power off the system:" +"Rust code. For example, to make an HVC (hypervisor call) to tell the " +"firmware to power off the system:" msgstr "" #: src/bare-metal/aps/inline-assembly.md:6 @@ -14057,43 +13276,6 @@ msgid "" "We can use a struct to represent the memory layout of the UART's registers." msgstr "" -#: src/bare-metal/aps/better-uart/registers.md:5 -msgid "" -"```rust,editable,compile_fail\n" -"#[repr(C, align(4))]\n" -"struct Registers {\n" -" dr: u16,\n" -" _reserved0: [u8; 2],\n" -" rsr: ReceiveStatus,\n" -" _reserved1: [u8; 19],\n" -" fr: Flags,\n" -" _reserved2: [u8; 6],\n" -" ilpr: u8,\n" -" _reserved3: [u8; 3],\n" -" ibrd: u16,\n" -" _reserved4: [u8; 2],\n" -" fbrd: u8,\n" -" _reserved5: [u8; 3],\n" -" lcr_h: u8,\n" -" _reserved6: [u8; 3],\n" -" cr: u16,\n" -" _reserved7: [u8; 3],\n" -" ifls: u8,\n" -" _reserved8: [u8; 3],\n" -" imsc: u16,\n" -" _reserved9: [u8; 2],\n" -" ris: u16,\n" -" _reserved10: [u8; 2],\n" -" mis: u16,\n" -" _reserved11: [u8; 2],\n" -" icr: u16,\n" -" _reserved12: [u8; 2],\n" -" dmacr: u8,\n" -" _reserved13: [u8; 3],\n" -"}\n" -"```" -msgstr "" - #: src/bare-metal/aps/better-uart/registers.md:41 msgid "" "[`#[repr(C)]`](https://doc.rust-lang.org/reference/type-layout.html#the-c-" @@ -14373,63 +13555,6 @@ msgid "" "calling into Rust code:" msgstr "" -#: src/bare-metal/aps/exceptions.md:8 -msgid "" -"```rust,editable,compile_fail\n" -"use log::error;\n" -"use smccc::psci::system_off;\n" -"use smccc::Hvc;\n" -"\n" -"#[no_mangle]\n" -"extern \"C\" fn sync_exception_current(_elr: u64, _spsr: u64) {\n" -" error!(\"sync_exception_current\");\n" -" system_off::().unwrap();\n" -"}\n" -"\n" -"#[no_mangle]\n" -"extern \"C\" fn irq_current(_elr: u64, _spsr: u64) {\n" -" error!(\"irq_current\");\n" -" system_off::().unwrap();\n" -"}\n" -"\n" -"#[no_mangle]\n" -"extern \"C\" fn fiq_current(_elr: u64, _spsr: u64) {\n" -" error!(\"fiq_current\");\n" -" system_off::().unwrap();\n" -"}\n" -"\n" -"#[no_mangle]\n" -"extern \"C\" fn serr_current(_elr: u64, _spsr: u64) {\n" -" error!(\"serr_current\");\n" -" system_off::().unwrap();\n" -"}\n" -"\n" -"#[no_mangle]\n" -"extern \"C\" fn sync_lower(_elr: u64, _spsr: u64) {\n" -" error!(\"sync_lower\");\n" -" system_off::().unwrap();\n" -"}\n" -"\n" -"#[no_mangle]\n" -"extern \"C\" fn irq_lower(_elr: u64, _spsr: u64) {\n" -" error!(\"irq_lower\");\n" -" system_off::().unwrap();\n" -"}\n" -"\n" -"#[no_mangle]\n" -"extern \"C\" fn fiq_lower(_elr: u64, _spsr: u64) {\n" -" error!(\"fiq_lower\");\n" -" system_off::().unwrap();\n" -"}\n" -"\n" -"#[no_mangle]\n" -"extern \"C\" fn serr_lower(_elr: u64, _spsr: u64) {\n" -" error!(\"serr_lower\");\n" -" system_off::().unwrap();\n" -"}\n" -"```" -msgstr "" - #: src/bare-metal/aps/exceptions.md:64 msgid "EL is exception level; all our examples this afternoon run in EL1." msgstr "" @@ -14516,7 +13641,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 " @@ -14540,43 +13665,6 @@ msgid "" "types." msgstr "" -#: src/bare-metal/useful-crates/zerocopy.md:6 -msgid "" -"```rust,editable,compile_fail\n" -"use zerocopy::AsBytes;\n" -"\n" -"#[repr(u32)]\n" -"#[derive(AsBytes, Debug, Default)]\n" -"enum RequestType {\n" -" #[default]\n" -" In = 0,\n" -" Out = 1,\n" -" Flush = 4,\n" -"}\n" -"\n" -"#[repr(C)]\n" -"#[derive(AsBytes, Debug, Default)]\n" -"struct VirtioBlockRequest {\n" -" request_type: RequestType,\n" -" reserved: u32,\n" -" sector: u64,\n" -"}\n" -"\n" -"fn main() {\n" -" let request = VirtioBlockRequest {\n" -" request_type: RequestType::Flush,\n" -" sector: 42,\n" -" ..Default::default()\n" -" };\n" -"\n" -" assert_eq!(\n" -" request.as_bytes(),\n" -" &[4, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0]\n" -" );\n" -"}\n" -"```" -msgstr "" - #: src/bare-metal/useful-crates/zerocopy.md:40 msgid "" "This is not suitable for MMIO (as it doesn't use volatile reads and writes), " @@ -14678,25 +13766,6 @@ msgid "" "space for PCI BARs:" msgstr "" -#: src/bare-metal/useful-crates/buddy_system_allocator.md:8 -msgid "" -"```rust,editable,compile_fail\n" -"use buddy_system_allocator::FrameAllocator;\n" -"use core::alloc::Layout;\n" -"\n" -"fn main() {\n" -" let mut allocator = FrameAllocator::<32>::new();\n" -" allocator.add_frame(0x200_0000, 0x400_0000);\n" -"\n" -" let layout = Layout::from_size_align(0x100, 0x100).unwrap();\n" -" let bar = allocator\n" -" .alloc_aligned(layout)\n" -" .expect(\"Failed to allocate 0x100 byte MMIO region\");\n" -" println!(\"Allocated 0x100 byte MMIO region at {:#x}\", bar);\n" -"}\n" -"```" -msgstr "" - #: src/bare-metal/useful-crates/buddy_system_allocator.md:26 msgid "PCI BARs always have alignment equal to their size." msgstr "" @@ -14721,22 +13790,6 @@ msgid "" "and panics if you try to use more than are allocated." msgstr "" -#: src/bare-metal/useful-crates/tinyvec.md:8 -msgid "" -"```rust,editable,compile_fail\n" -"use tinyvec::{array_vec, ArrayVec};\n" -"\n" -"fn main() {\n" -" let mut numbers: ArrayVec<[u32; 5]> = array_vec!(42, 66);\n" -" println!(\"{numbers:?}\");\n" -" numbers.push(7);\n" -" println!(\"{numbers:?}\");\n" -" numbers.remove(1);\n" -" println!(\"{numbers:?}\");\n" -"}\n" -"```" -msgstr "" - #: src/bare-metal/useful-crates/tinyvec.md:23 msgid "" "`tinyvec` requires that the element type implement `Default` for " @@ -14765,21 +13818,6 @@ msgid "" "equivalents of many of these primitives." msgstr "" -#: src/bare-metal/useful-crates/spin.md:9 -msgid "" -"```rust,editable,compile_fail\n" -"use spin::mutex::SpinMutex;\n" -"\n" -"static counter: SpinMutex = SpinMutex::new(0);\n" -"\n" -"fn main() {\n" -" println!(\"count: {}\", counter.lock());\n" -" *counter.lock() += 2;\n" -" println!(\"count: {}\", counter.lock());\n" -"}\n" -"```" -msgstr "" - #: src/bare-metal/useful-crates/spin.md:23 msgid "Be careful to avoid deadlock if you take locks in interrupt handlers." msgstr "" @@ -14810,48 +13848,6 @@ msgid "" "to convert the ELF to a raw binary ready to be run." msgstr "" -#: src/bare-metal/android.md:7 -msgid "" -"```soong\n" -"rust_ffi_static {\n" -" name: \"libvmbase_example\",\n" -" defaults: [\"vmbase_ffi_defaults\"],\n" -" crate_name: \"vmbase_example\",\n" -" srcs: [\"src/main.rs\"],\n" -" rustlibs: [\n" -" \"libvmbase\",\n" -" ],\n" -"}\n" -"\n" -"cc_binary {\n" -" name: \"vmbase_example\",\n" -" defaults: [\"vmbase_elf_defaults\"],\n" -" srcs: [\n" -" \"idmap.S\",\n" -" ],\n" -" static_libs: [\n" -" \"libvmbase_example\",\n" -" ],\n" -" linker_scripts: [\n" -" \"image.ld\",\n" -" \":vmbase_sections\",\n" -" ],\n" -"}\n" -"\n" -"raw_binary {\n" -" name: \"vmbase_example_bin\",\n" -" stem: \"vmbase_example.bin\",\n" -" src: \":vmbase_example\",\n" -" enabled: false,\n" -" target: {\n" -" android_arm64: {\n" -" enabled: true,\n" -" },\n" -" },\n" -"}\n" -"```" -msgstr "" - #: src/bare-metal/android/vmbase.md:3 msgid "" "For VMs running under crosvm on aarch64, the [vmbase](https://android." @@ -14860,22 +13856,6 @@ msgid "" "build rules, along with an entry point, UART console logging and more." msgstr "" -#: src/bare-metal/android/vmbase.md:6 -msgid "" -"```rust,compile_fail\n" -"#![no_main]\n" -"#![no_std]\n" -"\n" -"use vmbase::{main, println};\n" -"\n" -"main!(main);\n" -"\n" -"pub fn main(arg0: u64, arg1: u64, arg2: u64, arg3: u64) {\n" -" println!(\"Hello world\");\n" -"}\n" -"```" -msgstr "" - #: src/bare-metal/android/vmbase.md:21 msgid "" "The `main!` macro marks your main function, to be called from the `vmbase` " @@ -15000,7 +13980,7 @@ msgstr "" #: src/exercises/bare-metal/rtc.md:75 msgid "" -"`src/exceptions.rs` (you should only need to change this for the 3rd part of " +"_src/exceptions.rs_ (you should only need to change this for the 3rd part of " "the exercise):" msgstr "" @@ -15079,7 +14059,7 @@ msgid "" msgstr "" #: src/exercises/bare-metal/rtc.md:149 -msgid "`src/logger.rs` (you shouldn't need to change this):" +msgid "_src/logger.rs_ (you shouldn't need to change this):" msgstr "" #: src/exercises/bare-metal/rtc.md:153 @@ -15144,7 +14124,7 @@ msgid "" msgstr "" #: src/exercises/bare-metal/rtc.md:210 -msgid "`src/pl011.rs` (you shouldn't need to change this):" +msgid "_src/pl011.rs_ (you shouldn't need to change this):" msgstr "" #: src/exercises/bare-metal/rtc.md:214 @@ -15326,32 +14306,8 @@ msgid "" "```" msgstr "" -#: src/exercises/bare-metal/rtc.md:389 -msgid "" -"```toml\n" -"[workspace]\n" -"\n" -"[package]\n" -"name = \"rtc\"\n" -"version = \"0.1.0\"\n" -"edition = \"2021\"\n" -"publish = false\n" -"\n" -"[dependencies]\n" -"arm-gic = \"0.1.0\"\n" -"bitflags = \"2.0.0\"\n" -"chrono = { version = \"0.4.24\", default-features = false }\n" -"log = \"0.4.17\"\n" -"smccc = \"0.1.1\"\n" -"spin = \"0.9.8\"\n" -"\n" -"[build-dependencies]\n" -"cc = \"1.0.73\"\n" -"```" -msgstr "" - #: src/exercises/bare-metal/rtc.md:410 -msgid "`build.rs` (you shouldn't need to change this):" +msgid "_build.rs_ (you shouldn't need to change this):" msgstr "" #: src/exercises/bare-metal/rtc.md:414 @@ -15390,7 +14346,7 @@ msgid "" msgstr "" #: src/exercises/bare-metal/rtc.md:446 -msgid "`entry.S` (you shouldn't need to change this):" +msgid "_entry.S_ (you shouldn't need to change this):" msgstr "" #: src/exercises/bare-metal/rtc.md:450 @@ -15556,7 +14512,7 @@ msgid "" msgstr "" #: src/exercises/bare-metal/rtc.md:595 -msgid "`exceptions.S` (you shouldn't need to change this):" +msgid "_exceptions.S_ (you shouldn't need to change this):" msgstr "" #: src/exercises/bare-metal/rtc.md:599 @@ -15754,7 +14710,7 @@ msgid "" msgstr "" #: src/exercises/bare-metal/rtc.md:780 -msgid "`idmap.S` (you shouldn't need to change this):" +msgid "_idmap.S_ (you shouldn't need to change this):" msgstr "" #: src/exercises/bare-metal/rtc.md:784 @@ -15807,7 +14763,7 @@ msgid "" msgstr "" #: src/exercises/bare-metal/rtc.md:829 -msgid "`image.ld` (you shouldn't need to change this):" +msgid "_image.ld_ (you shouldn't need to change this):" msgstr "" #: src/exercises/bare-metal/rtc.md:833 @@ -15922,7 +14878,7 @@ msgid "" msgstr "" #: src/exercises/bare-metal/rtc.md:940 -msgid "`Makefile` (you shouldn't need to change this):" +msgid "_Makefile_ (you shouldn't need to change this):" msgstr "" #: src/exercises/bare-metal/rtc.md:944 @@ -15970,15 +14926,6 @@ msgid "" "```" msgstr "" -#: src/exercises/bare-metal/rtc.md:989 -msgid "" -"```toml\n" -"[build]\n" -"target = \"aarch64-unknown-none\"\n" -"rustflags = [\"-C\", \"link-arg=-Timage.ld\"]\n" -"```" -msgstr "" - #: src/exercises/bare-metal/rtc.md:995 msgid "Run the code in QEMU with `make qemu`." msgstr "" @@ -16128,7 +15075,6 @@ msgstr "" msgid "" "```rust,editable\n" "use std::sync::mpsc;\n" -"use std::thread;\n" "\n" "fn main() {\n" " let (tx, rx) = mpsc::channel();\n" @@ -16146,14 +15092,14 @@ msgid "" "```" msgstr "" -#: src/concurrency/channels.md:27 +#: src/concurrency/channels.md:26 msgid "" "`mpsc` stands for Multi-Producer, Single-Consumer. `Sender` and `SyncSender` " "implement `Clone` (so you can make multiple producers) but `Receiver` does " "not." msgstr "" -#: src/concurrency/channels.md:29 +#: src/concurrency/channels.md:28 msgid "" "`send()` and `recv()` return `Result`. If they return `Err`, it means the " "counterpart `Sender` or `Receiver` is dropped and the channel is closed." @@ -16247,7 +15193,7 @@ msgstr "" #: src/concurrency/send-sync.md:3 msgid "" -"How does Rust know to forbid shared access across thread? The answer is in " +"How does Rust know to forbid shared access across threads? The answer is in " "two traits:" msgstr "" @@ -16413,8 +15359,8 @@ msgstr "" #: src/concurrency/send-sync/examples.md:31 msgid "" -"`MutexGuard`: Uses OS level primitives which must be deallocated on the " -"thread which created them." +"`MutexGuard`: Uses OS level primitives which must be deallocated on " +"the thread which created them." msgstr "" #: src/concurrency/send-sync/examples.md:34 @@ -16745,7 +15691,7 @@ msgid "" "}\n" "\n" "static PHILOSOPHERS: &[&str] =\n" -" &[\"Socrates\", \"Plato\", \"Aristotle\", \"Thales\", \"Pythagoras\"];\n" +" &[\"Socrates\", \"Hypatia\", \"Plato\", \"Aristotle\", \"Pythagoras\"];\n" "\n" "fn main() {\n" " // Create forks\n" @@ -16787,15 +15733,6 @@ msgid "" "reqwest/). Create a new Cargo project and `reqwest` it as a dependency with:" 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" -"```" -msgstr "" - #: src/exercises/concurrency/link-checker.md:17 msgid "" "If `cargo add` fails with `error: no such subcommand`, then please edit the " @@ -16808,26 +15745,12 @@ msgid "" "rs/scraper/) for that:" msgstr "" -#: src/exercises/concurrency/link-checker.md:22 -msgid "" -"```shell\n" -"cargo add scraper\n" -"```" -msgstr "" - #: src/exercises/concurrency/link-checker.md:26 msgid "" "Finally, we'll need some way of handling errors. We use [`thiserror`]" "(https://docs.rs/thiserror/) for that:" msgstr "" -#: src/exercises/concurrency/link-checker.md:29 -msgid "" -"```shell\n" -"cargo add thiserror\n" -"```" -msgstr "" - #: src/exercises/concurrency/link-checker.md:33 msgid "" "The `cargo add` calls will update the `Cargo.toml` file to look like this:" @@ -16933,13 +15856,6 @@ msgstr "" msgid "Run the code in `src/main.rs` with" msgstr "" -#: src/exercises/concurrency/link-checker.md:122 -msgid "" -"```shell\n" -"cargo run\n" -"```" -msgstr "" - #: src/exercises/concurrency/link-checker.md:128 msgid "" "Use threads to check the links in parallel: send the URLs to be checked to a " @@ -17081,25 +15997,6 @@ msgid "" "doc.rust-lang.org/std/task/enum.Poll.html)." msgstr "" -#: src/async/futures.md:8 -msgid "" -"```rust\n" -"use std::pin::Pin;\n" -"use std::task::Context;\n" -"\n" -"pub trait Future {\n" -" type Output;\n" -" fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll;\n" -"}\n" -"\n" -"pub enum Poll {\n" -" Ready(T),\n" -" Pending,\n" -"}\n" -"```" -msgstr "" - #: src/async/futures.md:23 msgid "" "An async function returns an `impl Future`. It's also possible (but " @@ -17320,21 +16217,28 @@ msgstr "" #: src/async/tasks.md:54 msgid "" +"Try connecting to it with a TCP connection tool like [nc](https://www.unix." +"com/man-page/linux/1/nc/) or [telnet](https://www.unix.com/man-page/linux/1/" +"telnet/)." +msgstr "" + +#: src/async/tasks.md:56 +msgid "" "Ask students to visualize what the state of the example server would be with " "a few connected clients. What tasks exist? What are their Futures?" msgstr "" -#: src/async/tasks.md:57 +#: src/async/tasks.md:59 msgid "" "This is the first time we've seen an `async` block. This is similar to a " "closure, but does not take any arguments. Its return value is a Future, " "similar to an `async fn`. " msgstr "" -#: src/async/tasks.md:61 +#: src/async/tasks.md:63 msgid "" "Refactor the async block into a function, and improve the error handling " -"using `?`." +"using `?`. " msgstr "" #: src/async/channels.md:3 @@ -17551,7 +16455,7 @@ msgid "" "In this example, we have a race between a cat and a dog. " "`first_animal_to_finish_race` listens to both channels and will pick " "whichever arrives first. Since the dog takes 50ms, it wins against the cat " -"that take 500ms seconds." +"that take 500ms." msgstr "" #: src/async/control-flow/select.md:67 @@ -17776,19 +16680,6 @@ msgid "" "Instead, add a `timeout_fut` containing that future outside of the `loop`:" msgstr "" -#: src/async/pitfalls/pin.md:79 -msgid "" -"```rust,compile_fail\n" -"let mut timeout_fut = sleep(Duration::from_millis(100));\n" -"loop {\n" -" select! {\n" -" ..,\n" -" _ = timeout_fut => { println!(..); },\n" -" }\n" -"}\n" -"```" -msgstr "" - #: src/async/pitfalls/pin.md:88 msgid "" "This still doesn't work. Follow the compiler errors, adding `&mut` to the " @@ -17796,19 +16687,6 @@ msgid "" "pin`:" msgstr "" -#: src/async/pitfalls/pin.md:92 -msgid "" -"```rust,compile_fail\n" -"let mut timeout_fut = Box::pin(sleep(Duration::from_millis(100)));\n" -"loop {\n" -" select! {\n" -" ..,\n" -" _ = &mut timeout_fut => { println!(..); },\n" -" }\n" -"}\n" -"```" -msgstr "" - #: src/async/pitfalls/pin.md:102 msgid "" "This compiles, but once the timeout expires it is `Poll::Ready` on every " @@ -18010,7 +16888,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 "" @@ -18127,7 +17005,7 @@ msgid "" "}\n" "\n" "static PHILOSOPHERS: &[&str] =\n" -" &[\"Socrates\", \"Plato\", \"Aristotle\", \"Thales\", \"Pythagoras\"];\n" +" &[\"Socrates\", \"Hypatia\", \"Plato\", \"Aristotle\", \"Pythagoras\"];\n" "\n" "#[tokio::main]\n" "async fn main() {\n" @@ -18185,7 +17063,7 @@ msgstr "" msgid "" "For this, we use [a broadcast channel](https://docs.rs/tokio/latest/tokio/" "sync/broadcast/fn.channel.html) on the server, and [`tokio_websockets`]" -"(https://docs.rs/tokio-websockets/0.3.2/tokio_websockets/) for the " +"(https://docs.rs/tokio-websockets/0.4.0/tokio_websockets/) for the " "communication between the client and the server." msgstr "" @@ -18194,7 +17072,7 @@ msgid "Create a new Cargo project and add the following dependencies:" msgstr "" #: src/exercises/concurrency/chat-app.md:15 -msgid "`Cargo.toml`:" +msgid "_Cargo.toml_:" msgstr "" #: src/exercises/concurrency/chat-app.md:19 @@ -18206,10 +17084,11 @@ msgid "" "edition = \"2021\"\n" "\n" "[dependencies]\n" -"futures-util = \"0.3.28\"\n" +"futures-util = { version = \"0.3.28\", features = [\"sink\"] }\n" "http = \"0.2.9\"\n" "tokio = { version = \"1.28.1\", features = [\"full\"] }\n" -"tokio-websockets = \"0.3.2\"\n" +"tokio-websockets = { version = \"0.4.0\", features = [\"client\", " +"\"fastrand\", \"server\", \"sha1_smol\"] }\n" "```" msgstr "" @@ -18220,15 +17099,15 @@ msgstr "" #: src/exercises/concurrency/chat-app.md:33 msgid "" "You are going to need the following functions from `tokio` and " -"[`tokio_websockets`](https://docs.rs/tokio-websockets/0.3.2/" +"[`tokio_websockets`](https://docs.rs/tokio-websockets/0.4.0/" "tokio_websockets/). Spend a few minutes to familiarize yourself with the " "API. " msgstr "" #: src/exercises/concurrency/chat-app.md:37 msgid "" -"[WebsocketStream::next()](https://docs.rs/tokio-websockets/0.3.2/" -"tokio_websockets/proto/struct.WebsocketStream.html#method.next): for " +"[StreamExt::next()](https://docs.rs/futures-util/0.3.28/futures_util/stream/" +"trait.StreamExt.html#method.next) implemented by `WebsocketStream`: for " "asynchronously reading messages from a Websocket Stream." msgstr "" @@ -18275,14 +17154,15 @@ msgid "" msgstr "" #: src/exercises/concurrency/chat-app.md:59 -#: src/exercises/concurrency/solutions-afternoon.md:123 -msgid "`src/bin/server.rs`:" +#: src/exercises/concurrency/solutions-afternoon.md:99 +msgid "_src/bin/server.rs_:" msgstr "" #: src/exercises/concurrency/chat-app.md:63 msgid "" "```rust,compile_fail\n" "use futures_util::sink::SinkExt;\n" +"use futures_util::stream::StreamExt;\n" "use std::error::Error;\n" "use std::net::SocketAddr;\n" "use tokio::net::{TcpListener, TcpStream};\n" @@ -18321,14 +17201,15 @@ msgid "" "```" msgstr "" -#: src/exercises/concurrency/chat-app.md:102 -#: src/exercises/concurrency/solutions-afternoon.md:208 -msgid "`src/bin/client.rs`:" +#: src/exercises/concurrency/chat-app.md:103 +#: src/exercises/concurrency/solutions-afternoon.md:166 +msgid "_src/bin/client.rs_:" msgstr "" -#: src/exercises/concurrency/chat-app.md:106 +#: src/exercises/concurrency/chat-app.md:107 msgid "" "```rust,compile_fail\n" +"use futures_util::stream::StreamExt;\n" "use futures_util::SinkExt;\n" "use http::Uri;\n" "use tokio::io::{AsyncBufReadExt, BufReader};\n" @@ -18336,10 +17217,10 @@ msgid "" "\n" "#[tokio::main]\n" "async fn main() -> Result<(), tokio_websockets::Error> {\n" -" let mut ws_stream = ClientBuilder::from_uri(Uri::" -"from_static(\"ws://127.0.0.1:2000\"))\n" -" .connect()\n" -" .await?;\n" +" let (mut ws_stream, _) =\n" +" ClientBuilder::from_uri(Uri::from_static(\"ws://127.0.0.1:2000\"))\n" +" .connect()\n" +" .await?;\n" "\n" " let stdin = tokio::io::stdin();\n" " let mut stdin = BufReader::new(stdin).lines();\n" @@ -18351,48 +17232,34 @@ msgid "" "```" msgstr "" -#: src/exercises/concurrency/chat-app.md:127 +#: src/exercises/concurrency/chat-app.md:130 msgid "Running the binaries" msgstr "" -#: src/exercises/concurrency/chat-app.md:128 +#: src/exercises/concurrency/chat-app.md:131 msgid "Run the server with:" msgstr "" -#: src/exercises/concurrency/chat-app.md:130 -msgid "" -"```shell\n" -"cargo run --bin server\n" -"```" -msgstr "" - -#: src/exercises/concurrency/chat-app.md:134 +#: src/exercises/concurrency/chat-app.md:137 msgid "and the client with:" msgstr "" -#: src/exercises/concurrency/chat-app.md:136 -msgid "" -"```shell\n" -"cargo run --bin client\n" -"```" -msgstr "" - -#: src/exercises/concurrency/chat-app.md:142 +#: src/exercises/concurrency/chat-app.md:145 msgid "Implement the `handle_connection` function in `src/bin/server.rs`." msgstr "" -#: src/exercises/concurrency/chat-app.md:143 +#: src/exercises/concurrency/chat-app.md:146 msgid "" "Hint: Use `tokio::select!` for concurrently performing two tasks in a " "continuous loop. One task receives messages from the client and broadcasts " "them. The other sends messages received by the server to the client." msgstr "" -#: src/exercises/concurrency/chat-app.md:146 +#: src/exercises/concurrency/chat-app.md:149 msgid "Complete the main function in `src/bin/client.rs`." msgstr "" -#: src/exercises/concurrency/chat-app.md:147 +#: src/exercises/concurrency/chat-app.md:150 msgid "" "Hint: As before, use `tokio::select!` in a continuous loop for concurrently " "performing two tasks: (1) reading user messages from standard input and " @@ -18400,7 +17267,7 @@ msgid "" "displaying them for the user." msgstr "" -#: src/exercises/concurrency/chat-app.md:151 +#: src/exercises/concurrency/chat-app.md:154 msgid "" "Optional: Once you are done, change the code to broadcast messages to all " "clients, but the sender of the message." @@ -18420,6 +17287,296 @@ msgid "" "comprehensive-rust/discussions). We would love to hear from you." msgstr "" +#: src/glossary.md:3 +msgid "" +"The following is a glossary which aims to give a short definition of many " +"Rust terms. For translations, this also serves to connect the term back to " +"the English original." +msgstr "" + +#: src/glossary.md:30 +msgid "" +"allocate: \n" +"Dynamic memory allocation on [the heap](memory-management/stack-vs-heap.md)." +msgstr "" + +#: src/glossary.md:32 +msgid "argument:" +msgstr "" + +#: src/glossary.md:33 +msgid "" +"Bare-metal Rust: \n" +"Low-level Rust development, often deployed to a system without an operating " +"system. See [Bare-metal Rust](bare-metal.md)." +msgstr "" + +#: src/glossary.md:36 +msgid "" +"block: \n" +"See [Blocks](control-flow/blocks.md) and _scope_." +msgstr "" + +#: src/glossary.md:38 +msgid "" +"borrow: \n" +"See [Borrowing](ownership/borrowing.md)." +msgstr "" + +#: src/glossary.md:40 +msgid "" +"borrow checker: \n" +"The part of the Rust compiler which checks that all borrows are valid." +msgstr "" + +#: src/glossary.md:42 +msgid "" +"brace: \n" +"`{` and `}`. Also called _curly brace_, they delimit _blocks_." +msgstr "" + +#: src/glossary.md:44 +msgid "build:" +msgstr "" + +#: src/glossary.md:45 +msgid "call:" +msgstr "" + +#: src/glossary.md:46 +msgid "" +"channel: \n" +"Used to safely pass messages [between threads](concurrency/channels.md)." +msgstr "" + +#: src/glossary.md:48 +msgid "" +"Comprehensive Rust 🦀: \n" +"The courses here are jointly called Comprehensive Rust 🦀." +msgstr "" + +#: src/glossary.md:50 +msgid "concurrency:" +msgstr "eşzamanlılık:" + +#: src/glossary.md:51 +msgid "" +"Concurrency in Rust: \n" +"See [Concurrency in Rust](concurrency.md)." +msgstr "" + +#: src/glossary.md:53 +msgid "constant:" +msgstr "" + +#: src/glossary.md:54 +msgid "control flow:" +msgstr "kontrol akışı:" + +#: src/glossary.md:55 +msgid "crash:" +msgstr "" + +#: src/glossary.md:56 +msgid "enumeration:" +msgstr "numaralandırma:" + +#: src/glossary.md:57 +msgid "error:" +msgstr "" + +#: src/glossary.md:58 +msgid "error handling:" +msgstr "hata işleme:" + +#: src/glossary.md:59 +msgid "exercise:" +msgstr "egzersiz:" + +#: src/glossary.md:60 +msgid "function:" +msgstr "fonksiyon:" + +#: src/glossary.md:61 +msgid "garbage collector:" +msgstr "çöp toplama:" + +#: src/glossary.md:62 +msgid "generics:" +msgstr "jenerikler:" + +#: src/glossary.md:63 +msgid "immutable:" +msgstr "" + +#: src/glossary.md:64 +msgid "integration test:" +msgstr "entegrasyon testi:" + +#: src/glossary.md:65 +msgid "keyword:" +msgstr "" + +#: src/glossary.md:66 +msgid "library:" +msgstr "kütüphane:" + +#: src/glossary.md:67 +msgid "macro:" +msgstr "" + +#: src/glossary.md:68 +msgid "main function:" +msgstr "main fonksiyonu:" + +#: src/glossary.md:69 +msgid "match:" +msgstr "" + +#: src/glossary.md:70 +msgid "memory leak:" +msgstr "" + +#: src/glossary.md:71 +msgid "method:" +msgstr "metot:" + +#: src/glossary.md:72 +msgid "module:" +msgstr "modül:" + +#: src/glossary.md:73 +msgid "move:" +msgstr "" + +#: src/glossary.md:74 +msgid "mutable:" +msgstr "" + +#: src/glossary.md:75 +msgid "ownership:" +msgstr "sahiplik:" + +#: src/glossary.md:76 +msgid "panic:" +msgstr "panik:" + +#: src/glossary.md:77 +msgid "parameter:" +msgstr "" + +#: src/glossary.md:78 +msgid "pattern:" +msgstr "" + +#: src/glossary.md:79 +msgid "payload:" +msgstr "" + +#: src/glossary.md:80 +msgid "program:" +msgstr "" + +#: src/glossary.md:81 +msgid "programming language:" +msgstr "" + +#: src/glossary.md:82 +msgid "receiver:" +msgstr "alıcı:" + +#: src/glossary.md:83 +msgid "reference counting:" +msgstr "" + +#: src/glossary.md:84 +msgid "return:" +msgstr "" + +#: src/glossary.md:85 +msgid "Rust:" +msgstr "Rust:" + +#: src/glossary.md:86 +msgid "" +"Rust Fundamentals: \n" +"Days 1 to 3 of this course." +msgstr "" + +#: src/glossary.md:88 +msgid "" +"Rust in Android: \n" +"See [Rust in Android](android.md)." +msgstr "" + +#: src/glossary.md:90 +msgid "safe:" +msgstr "" + +#: src/glossary.md:91 +msgid "scope:" +msgstr "" + +#: src/glossary.md:92 +msgid "standard library:" +msgstr "standart kütüphane:" + +#: src/glossary.md:93 +msgid "static:" +msgstr "" + +#: src/glossary.md:94 +msgid "string:" +msgstr "string:" + +#: src/glossary.md:95 +msgid "struct:" +msgstr "yapı:" + +#: src/glossary.md:96 +msgid "test:" +msgstr "" + +#: src/glossary.md:97 +msgid "thread:" +msgstr "iş parçacığı:" + +#: src/glossary.md:98 +msgid "thread safety:" +msgstr "" + +#: src/glossary.md:99 +msgid "trait:" +msgstr "özellik (trait):" + +#: src/glossary.md:100 +msgid "type:" +msgstr "" + +#: src/glossary.md:101 +msgid "type inference:" +msgstr "tür çıkarımı:" + +#: src/glossary.md:102 +msgid "undefined behavior:" +msgstr "" + +#: src/glossary.md:103 +msgid "union:" +msgstr "birlik (union):" + +#: src/glossary.md:104 +msgid "unit test:" +msgstr "birim testi:" + +#: src/glossary.md:105 +msgid "unsafe:" +msgstr "" + +#: src/glossary.md:106 +msgid "variable:\\" +msgstr "değişken:\\" + #: src/other-resources.md:1 msgid "Other Rust Resources" msgstr "" @@ -18602,6 +17759,15 @@ msgid "" "directory for details, including the license terms." msgstr "" +#: src/credits.md:34 +msgid "" +"The [Why Rust? - An Example in C](why-rust/an-example-in-c.md) section has " +"been taken from the presentation slides of [Colin Finck's Master Thesis]" +"(https://colinfinck.de/Master_Thesis_Colin_Finck.pdf). It has been " +"relicensed under the terms of the Apache 2.0 license for this course by the " +"author." +msgstr "" + #: src/exercises/solutions.md:3 msgid "You will find solutions to the exercises on the following pages." msgstr "" @@ -18613,13 +17779,6 @@ msgid "" "different or better solution than what is presented here." msgstr "" -#: src/exercises/solutions.md:10 -msgid "" -"**Note:** Please ignore the `// ANCHOR: label` and `// ANCHOR_END: label` " -"comments you see in the solutions. They are there to make it possible to re-" -"use parts of the solutions as the exercises." -msgstr "" - #: src/exercises/day-1/solutions-morning.md:1 msgid "Day 1 Morning Exercises" msgstr "" @@ -18631,23 +17790,7 @@ msgstr "" #: src/exercises/day-1/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" -"// ANCHOR: transpose\n" "fn transpose(matrix: [[i32; 3]; 3]) -> [[i32; 3]; 3] {\n" -" // ANCHOR_END: transpose\n" " let mut result = [[0; 3]; 3];\n" " for i in 0..3 {\n" " for j in 0..3 {\n" @@ -18657,15 +17800,12 @@ msgid "" " return result;\n" "}\n" "\n" -"// ANCHOR: pretty_print\n" "fn pretty_print(matrix: &[[i32; 3]; 3]) {\n" -" // ANCHOR_END: pretty_print\n" " for row in matrix {\n" " println!(\"{row:?}\");\n" " }\n" "}\n" "\n" -"// ANCHOR: tests\n" "#[test]\n" "fn test_transpose() {\n" " let matrix = [\n" @@ -18683,9 +17823,7 @@ msgid "" " ]\n" " );\n" "}\n" -"// ANCHOR_END: tests\n" "\n" -"// ANCHOR: main\n" "fn main() {\n" " let matrix = [\n" " [101, 102, 103], // <-- the comment makes rustfmt add a newline\n" @@ -18703,11 +17841,11 @@ msgid "" "```" msgstr "" -#: src/exercises/day-1/solutions-morning.md:78 +#: src/exercises/day-1/solutions-morning.md:57 msgid "Bonus question" msgstr "" -#: src/exercises/day-1/solutions-morning.md:80 +#: src/exercises/day-1/solutions-morning.md:59 msgid "" "It requires more advanced concepts. It might seem that we could use a slice-" "of-slices (`&[&[i32]]`) as the input type to transpose and thus make our " @@ -18715,21 +17853,21 @@ msgid "" "return type cannot be `&[&[i32]]` since it needs to own the data you return." msgstr "" -#: src/exercises/day-1/solutions-morning.md:82 +#: src/exercises/day-1/solutions-morning.md:61 msgid "" "You can attempt to use something like `Vec>`, but this doesn't work " "out-of-the-box either: it's hard to convert from `Vec>` to " "`&[&[i32]]` so now you cannot easily use `pretty_print` either." msgstr "" -#: src/exercises/day-1/solutions-morning.md:84 +#: src/exercises/day-1/solutions-morning.md:63 msgid "" "Once we get to traits and generics, we'll be able to use the [`std::convert::" "AsRef`](https://doc.rust-lang.org/std/convert/trait.AsRef.html) trait to " "abstract over anything that can be referenced as a slice." msgstr "" -#: src/exercises/day-1/solutions-morning.md:86 +#: src/exercises/day-1/solutions-morning.md:65 msgid "" "```rust\n" "use std::convert::AsRef;\n" @@ -18759,7 +17897,7 @@ msgid "" "```" msgstr "" -#: src/exercises/day-1/solutions-morning.md:113 +#: src/exercises/day-1/solutions-morning.md:92 msgid "" "In addition, the type itself would not enforce that the child slices are of " "the same length, so such variable could contain an invalid matrix." @@ -18776,42 +17914,31 @@ msgstr "" #: 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" +" let mut double = false;\n" +" let mut digit_seen = 0;\n" +"\n" +" for c in cc_number.chars().filter(|&f| f != ' ').rev() {\n" +" if let Some(digit) = c.to_digit(10) {\n" +" if double {\n" +" let double_digit = digit * 2;\n" +" sum += if double_digit > 9 {\n" +" double_digit - 9\n" " } else {\n" -" d\n" +" double_digit\n" " };\n" -" digits_seen += 1;\n" +" } else {\n" +" sum += digit;\n" " }\n" -" None => return false,\n" +" double = !double;\n" +" digit_seen += 1;\n" +" } else {\n" +" return false;\n" " }\n" " }\n" "\n" -" if digits_seen < 2 {\n" +" if digit_seen < 2 {\n" " return false;\n" " }\n" "\n" @@ -18826,10 +17953,10 @@ msgid "" " );\n" "}\n" "\n" -"// ANCHOR: unit-tests\n" "#[test]\n" "fn test_non_digit_cc_number() {\n" " assert!(!luhn(\"foo\"));\n" +" assert!(!luhn(\"foo 0 0\"));\n" "}\n" "\n" "#[test]\n" @@ -18863,17 +17990,142 @@ msgid "" " 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 +#: src/exercises/day-1/solutions-afternoon.md:86 msgid "Pattern matching" -msgstr "Şablon Eşleştirme" +msgstr "Desen eşleştirme" -#: src/exercises/day-1/solutions-afternoon.md:99 -msgid "TBD." +#: src/exercises/day-1/solutions-afternoon.md:88 +msgid "" +"```rust\n" +"/// An operation to perform on two subexpressions.\n" +"#[derive(Debug)]\n" +"enum Operation {\n" +" Add,\n" +" Sub,\n" +" Mul,\n" +" Div,\n" +"}\n" +"\n" +"/// An expression, in tree form.\n" +"#[derive(Debug)]\n" +"enum Expression {\n" +" /// An operation on two subexpressions.\n" +" Op {\n" +" op: Operation,\n" +" left: Box,\n" +" right: Box,\n" +" },\n" +"\n" +" /// A literal value\n" +" Value(i64),\n" +"}\n" +"\n" +"/// The result of evaluating an expression.\n" +"#[derive(Debug, PartialEq, Eq)]\n" +"enum Res {\n" +" /// Evaluation was successful, with the given result.\n" +" Ok(i64),\n" +" /// Evaluation failed, with the given error message.\n" +" Err(String),\n" +"}\n" +"// Allow `Ok` and `Err` as shorthands for `Res::Ok` and `Res::Err`.\n" +"use Res::{Err, Ok};\n" +"\n" +"fn eval(e: Expression) -> Res {\n" +" match e {\n" +" Expression::Op { op, left, right } => {\n" +" let left = match eval(*left) {\n" +" Ok(v) => v,\n" +" Err(msg) => return Err(msg),\n" +" };\n" +" let right = match eval(*right) {\n" +" Ok(v) => v,\n" +" Err(msg) => return Err(msg),\n" +" };\n" +" Ok(match op {\n" +" Operation::Add => left + right,\n" +" Operation::Sub => left - right,\n" +" Operation::Mul => left * right,\n" +" Operation::Div => {\n" +" if right == 0 {\n" +" return Err(String::from(\"division by zero\"));\n" +" } else {\n" +" left / right\n" +" }\n" +" }\n" +" })\n" +" }\n" +" Expression::Value(v) => Ok(v),\n" +" }\n" +"}\n" +"\n" +"#[test]\n" +"fn test_value() {\n" +" assert_eq!(eval(Expression::Value(19)), Ok(19));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_sum() {\n" +" assert_eq!(\n" +" eval(Expression::Op {\n" +" op: Operation::Add,\n" +" left: Box::new(Expression::Value(10)),\n" +" right: Box::new(Expression::Value(20)),\n" +" }),\n" +" Ok(30)\n" +" );\n" +"}\n" +"\n" +"#[test]\n" +"fn test_recursion() {\n" +" let term1 = Expression::Op {\n" +" op: Operation::Mul,\n" +" left: Box::new(Expression::Value(10)),\n" +" right: Box::new(Expression::Value(9)),\n" +" };\n" +" let term2 = Expression::Op {\n" +" op: Operation::Mul,\n" +" left: Box::new(Expression::Op {\n" +" op: Operation::Sub,\n" +" left: Box::new(Expression::Value(3)),\n" +" right: Box::new(Expression::Value(4)),\n" +" }),\n" +" right: Box::new(Expression::Value(5)),\n" +" };\n" +" assert_eq!(\n" +" eval(Expression::Op {\n" +" op: Operation::Add,\n" +" left: Box::new(term1),\n" +" right: Box::new(term2),\n" +" }),\n" +" Ok(85)\n" +" );\n" +"}\n" +"\n" +"#[test]\n" +"fn test_error() {\n" +" assert_eq!(\n" +" eval(Expression::Op {\n" +" op: Operation::Div,\n" +" left: Box::new(Expression::Value(99)),\n" +" right: Box::new(Expression::Value(0)),\n" +" }),\n" +" Err(String::from(\"division by zero\"))\n" +" );\n" +"}\n" +"fn main() {\n" +" let expr = Expression::Op {\n" +" op: Operation::Sub,\n" +" left: Box::new(Expression::Value(20)),\n" +" right: Box::new(Expression::Value(10)),\n" +" };\n" +" println!(\"expr: {:?}\", expr);\n" +" println!(\"result: {:?}\", eval(expr));\n" +"}\n" +"```" msgstr "" #: src/exercises/day-2/solutions-morning.md:1 @@ -18891,21 +18143,6 @@ msgstr "" #: 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" -"// ANCHOR: setup\n" "struct Library {\n" " books: Vec,\n" "}\n" @@ -18925,65 +18162,37 @@ msgid "" " }\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" +"// Implement the methods below. Notice how the `self` parameter\n" +"// changes type to indicate the method's required level of ownership\n" +"// 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" -" // ANCHOR_END: setup\n" "\n" -" // ANCHOR: Library_new\n" " fn new() -> Library {\n" -" // ANCHOR_END: Library_new\n" " Library { books: Vec::new() }\n" " }\n" "\n" -" // ANCHOR: Library_len\n" -" //fn len(self) -> usize {\n" -" // todo!(\"Return the length of `self.books`\")\n" -" //}\n" -" // ANCHOR_END: Library_len\n" " fn len(&self) -> usize {\n" " self.books.len()\n" " }\n" "\n" -" // ANCHOR: Library_is_empty\n" -" //fn is_empty(self) -> bool {\n" -" // todo!(\"Return `true` if `self.books` is empty\")\n" -" //}\n" -" // ANCHOR_END: Library_is_empty\n" " fn is_empty(&self) -> bool {\n" " self.books.is_empty()\n" " }\n" "\n" -" // ANCHOR: Library_add_book\n" -" //fn add_book(self, book: Book) {\n" -" // todo!(\"Add a new book to `self.books`\")\n" -" //}\n" -" // ANCHOR_END: Library_add_book\n" " fn add_book(&mut self, book: Book) {\n" " self.books.push(book)\n" " }\n" "\n" -" // ANCHOR: Library_print_books\n" -" //fn print_books(self) {\n" -" // todo!(\"Iterate over `self.books` and each book's title and " -"year\")\n" -" //}\n" -" // ANCHOR_END: Library_print_books\n" " fn print_books(&self) {\n" " for book in &self.books {\n" " println!(\"{}, published in {}\", book.title, book.year);\n" " }\n" " }\n" "\n" -" // ANCHOR: Library_oldest_book\n" -" //fn oldest_book(self) -> Option<&Book> {\n" -" // todo!(\"Return a reference to the oldest book (if any)\")\n" -" //}\n" -" // ANCHOR_END: Library_oldest_book\n" " fn oldest_book(&self) -> Option<&Book> {\n" " // Using a closure and a built-in method:\n" " // self.books.iter().min_by_key(|book| book.year)\n" @@ -19000,36 +18209,33 @@ msgid "" " }\n" "}\n" "\n" -"// ANCHOR: main\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" +" let mut 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\", " +" println!(\n" +" \"The library is empty: library.is_empty() -> {}\",\n" +" library.is_empty()\n" +" );\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" +" println!(\n" +" \"The library is no longer empty: library.is_empty() -> {}\",\n" +" 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" -"// ANCHOR_END: main\n" "\n" "#[test]\n" "fn test_library_len() {\n" @@ -19085,6 +18291,132 @@ msgid "" "```" msgstr "" +#: src/exercises/day-2/solutions-morning.md:153 +msgid "([back to exercise](health-statistics.md))" +msgstr "" + +#: src/exercises/day-2/solutions-morning.md:155 +msgid "" +"```rust\n" +"pub struct User {\n" +" name: String,\n" +" age: u32,\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, height: f32) -> Self {\n" +" Self {\n" +" name,\n" +" age,\n" +" height,\n" +" visit_count: 0,\n" +" last_blood_pressure: None,\n" +" }\n" +" }\n" +"\n" +" pub fn name(&self) -> &str {\n" +" &self.name\n" +" }\n" +"\n" +" pub fn age(&self) -> u32 {\n" +" self.age\n" +" }\n" +"\n" +" pub fn height(&self) -> f32 {\n" +" self.height\n" +" }\n" +"\n" +" pub fn doctor_visits(&self) -> u32 {\n" +" self.visit_count as u32\n" +" }\n" +"\n" +" pub fn set_age(&mut self, new_age: u32) {\n" +" self.age = new_age\n" +" }\n" +"\n" +" pub fn set_height(&mut self, new_height: f32) {\n" +" self.height = new_height\n" +" }\n" +"\n" +" pub fn visit_doctor(&mut self, measurements: Measurements) -> " +"HealthReport {\n" +" self.visit_count += 1;\n" +" let bp = measurements.blood_pressure;\n" +" let report = HealthReport {\n" +" patient_name: &self.name,\n" +" visit_count: self.visit_count as u32,\n" +" height_change: measurements.height - self.height,\n" +" blood_pressure_change: match self.last_blood_pressure {\n" +" Some(lbp) => Some((\n" +" bp.0 as i32 - lbp.0 as i32,\n" +" bp.1 as i32 - lbp.1 as i32\n" +" )),\n" +" None => None,\n" +" }\n" +" };\n" +" self.height = measurements.height;\n" +" self.last_blood_pressure = Some(bp);\n" +" report\n" +" }\n" +"}\n" +"\n" +"fn main() {\n" +" let bob = User::new(String::from(\"Bob\"), 32, 155.2);\n" +" println!(\"I'm {} and my age is {}\", bob.name(), bob.age());\n" +"}\n" +"\n" +"#[test]\n" +"fn test_height() {\n" +" let bob = User::new(String::from(\"Bob\"), 32, 155.2);\n" +" assert_eq!(bob.height(), 155.2);\n" +"}\n" +"\n" +"#[test]\n" +"fn test_set_age() {\n" +" let mut bob = User::new(String::from(\"Bob\"), 32, 155.2);\n" +" assert_eq!(bob.age(), 32);\n" +" bob.set_age(33);\n" +" assert_eq!(bob.age(), 33);\n" +"}\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" +" let report = bob.visit_doctor(Measurements {\n" +" height: 156.1,\n" +" blood_pressure: (115, 76),\n" +" });\n" +"\n" +" assert_eq!(report.visit_count, 2);\n" +" assert_eq!(report.blood_pressure_change, Some((-5, -4)));\n" +"}\n" +"```" +msgstr "" + #: src/exercises/day-2/solutions-afternoon.md:1 msgid "Day 2 Afternoon Exercises" msgstr "" @@ -19096,23 +18428,7 @@ msgstr "" #: 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: prefix_matches\n" "pub fn prefix_matches(prefix: &str, request_path: &str) -> bool {\n" -" // ANCHOR_END: prefix_matches\n" "\n" " let mut request_segments = request_path.split('/');\n" "\n" @@ -19139,7 +18455,6 @@ msgid "" " // and then returns None indefinitely.\n" "}\n" "\n" -"// ANCHOR: unit-tests\n" "#[test]\n" "fn test_matches_without_wildcard() {\n" " assert!(prefix_matches(\"/v1/publishers\", \"/v1/publishers\"));\n" @@ -19176,7 +18491,6 @@ msgid "" " \"/v1/publishers/foo/booksByAuthor\"\n" " ));\n" "}\n" -"// ANCHOR_END: unit-tests\n" "\n" "fn main() {}\n" "```" @@ -19193,21 +18507,6 @@ msgstr "" #: src/exercises/day-3/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" -"// ANCHOR: setup\n" "pub trait Widget {\n" " /// Natural width of `self`.\n" " fn width(&self) -> usize;\n" @@ -19237,14 +18536,12 @@ msgid "" "\n" "pub struct Button {\n" " label: Label,\n" -" callback: Box,\n" "}\n" "\n" "impl Button {\n" -" fn new(label: &str, callback: Box) -> Button {\n" +" fn new(label: &str) -> Button {\n" " Button {\n" " label: Label::new(label),\n" -" callback,\n" " }\n" " }\n" "}\n" @@ -19274,19 +18571,14 @@ msgid "" " }\n" "}\n" "\n" -"// ANCHOR_END: setup\n" "\n" -"// ANCHOR: Window-width\n" "impl Widget for Window {\n" " fn width(&self) -> usize {\n" -" // ANCHOR_END: Window-width\n" " // Add 4 paddings for borders\n" " self.inner_width() + 4\n" " }\n" "\n" -" // ANCHOR: Window-draw_into\n" " fn draw_into(&self, buffer: &mut dyn std::fmt::Write) {\n" -" // ANCHOR_END: Window-draw_into\n" " let mut inner = String::new();\n" " for widget in &self.widgets {\n" " widget.draw_into(&mut inner);\n" @@ -19307,16 +18599,12 @@ msgid "" " }\n" "}\n" "\n" -"// ANCHOR: Button-width\n" "impl Widget for Button {\n" " fn width(&self) -> usize {\n" -" // ANCHOR_END: Button-width\n" " self.label.width() + 8 // add a bit of padding\n" " }\n" "\n" -" // ANCHOR: Button-draw_into\n" " fn draw_into(&self, buffer: &mut dyn std::fmt::Write) {\n" -" // ANCHOR_END: Button-draw_into\n" " let width = self.width();\n" " let mut label = String::new();\n" " self.label.draw_into(&mut label);\n" @@ -19329,10 +18617,8 @@ msgid "" " }\n" "}\n" "\n" -"// ANCHOR: Label-width\n" "impl Widget for Label {\n" " fn width(&self) -> usize {\n" -" // ANCHOR_END: Label-width\n" " self.label\n" " .lines()\n" " .map(|line| line.chars().count())\n" @@ -19340,60 +18626,37 @@ msgid "" " .unwrap_or(0)\n" " }\n" "\n" -" // ANCHOR: Label-draw_into\n" " fn draw_into(&self, buffer: &mut dyn std::fmt::Write) {\n" -" // ANCHOR_END: Label-draw_into\n" " writeln!(buffer, \"{}\", &self.label).unwrap();\n" " }\n" "}\n" "\n" -"// ANCHOR: main\n" "fn main() {\n" " let mut window = Window::new(\"Rust GUI Demo 1.23\");\n" " window.add_widget(Box::new(Label::new(\"This is a small text GUI demo." "\")));\n" " window.add_widget(Box::new(Button::new(\n" -" \"Click me!\",\n" -" Box::new(|| println!(\"You clicked the button!\")),\n" +" \"Click me!\"\n" " )));\n" " window.draw();\n" "}\n" -"// ANCHOR_END: main\n" "```" msgstr "" -#: src/exercises/day-3/solutions-morning.md:177 +#: src/exercises/day-3/solutions-morning.md:144 msgid "([back to exercise](points-polygons.md))" msgstr "" -#: src/exercises/day-3/solutions-morning.md:179 +#: src/exercises/day-3/solutions-morning.md:146 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" @@ -19429,15 +18692,11 @@ msgid "" " }\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" @@ -19481,16 +18740,12 @@ msgid "" " }\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" @@ -19504,12 +18759,10 @@ msgid "" " }\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" @@ -19532,7 +18785,6 @@ msgid "" " }\n" "}\n" "\n" -"// ANCHOR: unit-tests\n" "#[cfg(test)]\n" "mod tests {\n" " use super::*;\n" @@ -19603,7 +18855,6 @@ msgid "" " assert_eq!(perimeters, vec![15.48, 31.42]);\n" " }\n" "}\n" -"// ANCHOR_END: unit-tests\n" "\n" "fn main() {}\n" "```" @@ -19620,21 +18871,6 @@ msgstr "" #: src/exercises/day-3/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: ffi\n" "mod ffi {\n" " use std::os::raw::{c_char, c_int};\n" " #[cfg(not(target_os = \"macos\"))]\n" @@ -19704,14 +18940,11 @@ msgid "" " path: CString,\n" " dir: *mut ffi::DIR,\n" "}\n" -"// ANCHOR_END: ffi\n" "\n" -"// ANCHOR: DirectoryIterator\n" "impl DirectoryIterator {\n" " fn new(path: &str) -> Result {\n" " // Call opendir and return a Ok value if that worked,\n" " // otherwise return Err with a message.\n" -" // ANCHOR_END: DirectoryIterator\n" " let path = CString::new(path).map_err(|err| format!(\"Invalid path: " "{err}\"))?;\n" " // SAFETY: path.as_ptr() cannot be NULL.\n" @@ -19724,12 +18957,10 @@ msgid "" " }\n" "}\n" "\n" -"// ANCHOR: Iterator\n" "impl Iterator for DirectoryIterator {\n" " type Item = OsString;\n" " fn next(&mut self) -> Option {\n" " // Keep calling readdir until we get a NULL pointer back.\n" -" // ANCHOR_END: Iterator\n" " // SAFETY: self.dir is never NULL.\n" " let dirent = unsafe { ffi::readdir(self.dir) };\n" " if dirent.is_null() {\n" @@ -19744,11 +18975,9 @@ msgid "" " }\n" "}\n" "\n" -"// ANCHOR: Drop\n" "impl Drop for DirectoryIterator {\n" " fn drop(&mut self) {\n" " // Call closedir as needed.\n" -" // ANCHOR_END: Drop\n" " if !self.dir.is_null() {\n" " // SAFETY: self.dir is not NULL.\n" " if unsafe { ffi::closedir(self.dir) } != 0 {\n" @@ -19758,13 +18987,11 @@ msgid "" " }\n" "}\n" "\n" -"// ANCHOR: main\n" "fn main() -> Result<(), String> {\n" " let iter = DirectoryIterator::new(\".\")?;\n" " println!(\"files: {:#?}\", iter.collect::>());\n" " Ok(())\n" "}\n" -"// ANCHOR_END: main\n" "\n" "#[cfg(test)]\n" "mod tests {\n" @@ -19820,21 +19047,6 @@ msgstr "" #: src/exercises/bare-metal/solutions-morning.md:7 msgid "" "```rust,compile_fail\n" -"// Copyright 2023 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: top\n" "#![no_main]\n" "#![no_std]\n" "\n" @@ -19842,7 +19054,6 @@ msgid "" "\n" "use core::fmt::Write;\n" "use cortex_m_rt::entry;\n" -"// ANCHOR_END: top\n" "use core::cmp::{max, min};\n" "use lsm303agr::{AccelOutputDataRate, Lsm303agr, MagOutputDataRate};\n" "use microbit::display::blocking::Display;\n" @@ -19856,7 +19067,6 @@ msgid "" "const COMPASS_SCALE: i32 = 30000;\n" "const ACCELEROMETER_SCALE: i32 = 700;\n" "\n" -"// ANCHOR: main\n" "#[entry]\n" "fn main() -> ! {\n" " let board = Board::take().unwrap();\n" @@ -19870,7 +19080,6 @@ msgid "" " );\n" "\n" " // Set up the I2C controller and Inertial Measurement Unit.\n" -" // ANCHOR_END: main\n" " writeln!(serial, \"Setting up IMU...\").unwrap();\n" " let i2c = Twim::new(board.TWIM0, board.i2c_internal.into(), FREQUENCY_A::" "K100);\n" @@ -19887,12 +19096,10 @@ msgid "" " let mut mode = Mode::Compass;\n" " let mut button_pressed = false;\n" "\n" -" // ANCHOR: loop\n" " writeln!(serial, \"Ready.\").unwrap();\n" "\n" " loop {\n" " // Read compass data and log it to the serial port.\n" -" // ANCHOR_END: loop\n" " while !(imu.mag_status().unwrap().xyz_new_data\n" " && imu.accel_status().unwrap().xyz_new_data)\n" " {}\n" @@ -19989,34 +19196,18 @@ msgid "([back to exercise](rtc.md))" msgstr "" #: src/exercises/bare-metal/solutions-afternoon.md:7 -msgid "`main.rs`:" +msgid "_main.rs_:" msgstr "" #: src/exercises/bare-metal/solutions-afternoon.md:9 msgid "" "```rust,compile_fail\n" -"// Copyright 2023 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: top\n" "#![no_main]\n" "#![no_std]\n" "\n" "mod exceptions;\n" "mod logger;\n" "mod pl011;\n" -"// ANCHOR_END: top\n" "mod pl031;\n" "\n" "use crate::pl031::Rtc;\n" @@ -20024,7 +19215,6 @@ msgid "" "use arm_gic::{irq_enable, wfi};\n" "use chrono::{TimeZone, Utc};\n" "use core::hint::spin_loop;\n" -"// ANCHOR: imports\n" "use crate::pl011::Uart;\n" "use arm_gic::gicv3::GicV3;\n" "use core::panic::PanicInfo;\n" @@ -20038,14 +19228,12 @@ msgid "" "\n" "/// Base address of the primary PL011 UART.\n" "const PL011_BASE_ADDRESS: *mut u32 = 0x900_0000 as _;\n" -"// ANCHOR_END: imports\n" "\n" "/// Base address of the PL031 RTC.\n" "const PL031_BASE_ADDRESS: *mut u32 = 0x901_0000 as _;\n" "/// The IRQ used by the PL031 RTC.\n" "const PL031_IRQ: IntId = IntId::spi(2);\n" "\n" -"// ANCHOR: main\n" "#[no_mangle]\n" "extern \"C\" fn main(x0: u64, x1: u64, x2: u64, x3: u64) {\n" " // Safe because `PL011_BASE_ADDRESS` is the base address of a PL011 " @@ -20063,7 +19251,6 @@ msgid "" " let mut gic = unsafe { GicV3::new(GICD_BASE_ADDRESS, " "GICR_BASE_ADDRESS) };\n" " gic.setup();\n" -" // ANCHOR_END: main\n" "\n" " // Safe because `PL031_BASE_ADDRESS` is the base address of a PL031 " "device,\n" @@ -20125,7 +19312,6 @@ msgid "" " );\n" " info!(\"Finished waiting\");\n" "\n" -" // ANCHOR: main_end\n" " system_off::().unwrap();\n" "}\n" "\n" @@ -20135,31 +19321,16 @@ msgid "" " system_off::().unwrap();\n" " loop {}\n" "}\n" -"// ANCHOR_END: main_end\n" "```" msgstr "" -#: src/exercises/bare-metal/solutions-afternoon.md:149 -msgid "`pl031.rs`:" +#: src/exercises/bare-metal/solutions-afternoon.md:127 +msgid "_pl031.rs_:" msgstr "" -#: src/exercises/bare-metal/solutions-afternoon.md:151 +#: src/exercises/bare-metal/solutions-afternoon.md:129 msgid "" "```rust\n" -"// Copyright 2023 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 core::ptr::{addr_of, addr_of_mut};\n" "\n" "#[repr(C, align(4))]\n" @@ -20288,21 +19459,6 @@ msgstr "" #: src/exercises/concurrency/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" -"// ANCHOR: Philosopher\n" "use std::sync::{mpsc, Arc, Mutex};\n" "use std::thread;\n" "use std::time::Duration;\n" @@ -20311,39 +19467,32 @@ msgid "" "\n" "struct Philosopher {\n" " name: String,\n" -" // ANCHOR_END: Philosopher\n" " left_fork: Arc>,\n" " right_fork: Arc>,\n" " thoughts: mpsc::SyncSender,\n" "}\n" "\n" -"// ANCHOR: Philosopher-think\n" "impl Philosopher {\n" " fn think(&self) {\n" " self.thoughts\n" " .send(format!(\"Eureka! {} has a new idea!\", &self.name))\n" " .unwrap();\n" " }\n" -" // ANCHOR_END: Philosopher-think\n" "\n" -" // ANCHOR: Philosopher-eat\n" " fn eat(&self) {\n" -" // ANCHOR_END: Philosopher-eat\n" " println!(\"{} is trying to eat\", &self.name);\n" " let left = self.left_fork.lock().unwrap();\n" " let right = self.right_fork.lock().unwrap();\n" "\n" -" // ANCHOR: Philosopher-eat-end\n" " println!(\"{} is eating...\", &self.name);\n" " thread::sleep(Duration::from_millis(10));\n" " }\n" "}\n" "\n" "static PHILOSOPHERS: &[&str] =\n" -" &[\"Socrates\", \"Plato\", \"Aristotle\", \"Thales\", \"Pythagoras\"];\n" +" &[\"Socrates\", \"Hypatia\", \"Plato\", \"Aristotle\", \"Pythagoras\"];\n" "\n" "fn main() {\n" -" // ANCHOR_END: Philosopher-eat-end\n" " let (tx, rx) = mpsc::sync_channel(10);\n" "\n" " let forks = (0..PHILOSOPHERS.len())\n" @@ -20385,34 +19534,19 @@ msgid "" "```" msgstr "" -#: src/exercises/concurrency/solutions-morning.md:104 +#: src/exercises/concurrency/solutions-morning.md:82 msgid "Link Checker" msgstr "" -#: src/exercises/concurrency/solutions-morning.md:106 +#: src/exercises/concurrency/solutions-morning.md:84 msgid "([back to exercise](link-checker.md))" msgstr "" -#: src/exercises/concurrency/solutions-morning.md:108 +#: src/exercises/concurrency/solutions-morning.md:86 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" @@ -20424,9 +19558,7 @@ msgid "" " #[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" @@ -20467,7 +19599,6 @@ msgid "" " }\n" " Ok(link_urls)\n" "}\n" -"// ANCHOR_END: visit_page\n" "\n" "struct CrawlState {\n" " domain: String,\n" @@ -20492,7 +19623,7 @@ msgid "" " url_domain == self.domain\n" " }\n" "\n" -" /// Mark the given page as visited, returning true if it had already\n" +" /// Mark the given page as visited, returning false 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" @@ -20599,21 +19730,6 @@ msgstr "" #: src/exercises/concurrency/solutions-afternoon.md:7 msgid "" "```rust,compile_fail\n" -"// Copyright 2023 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: Philosopher\n" "use std::sync::Arc;\n" "use tokio::time;\n" "use tokio::sync::mpsc::{self, Sender};\n" @@ -20623,13 +19739,11 @@ msgid "" "\n" "struct Philosopher {\n" " name: String,\n" -" // ANCHOR_END: Philosopher\n" " left_fork: Arc>,\n" " right_fork: Arc>,\n" " thoughts: Sender,\n" "}\n" "\n" -"// ANCHOR: Philosopher-think\n" "impl Philosopher {\n" " async fn think(&self) {\n" " self.thoughts\n" @@ -20637,12 +19751,9 @@ msgid "" "await\n" " .unwrap();\n" " }\n" -" // ANCHOR_END: Philosopher-think\n" "\n" -" // ANCHOR: Philosopher-eat\n" " async fn eat(&self) {\n" " // Pick up forks...\n" -" // ANCHOR_END: Philosopher-eat\n" " let _first_lock = self.left_fork.lock().await;\n" " // Add a delay before picking the second fork to allow the " "execution\n" @@ -20650,22 +19761,18 @@ msgid "" " time::sleep(time::Duration::from_millis(1)).await;\n" " let _second_lock = self.right_fork.lock().await;\n" "\n" -" // ANCHOR: Philosopher-eat-body\n" " println!(\"{} is eating...\", &self.name);\n" " time::sleep(time::Duration::from_millis(5)).await;\n" -" // ANCHOR_END: Philosopher-eat-body\n" "\n" " // The locks are dropped here\n" -" // ANCHOR: Philosopher-eat-end\n" " }\n" "}\n" "\n" "static PHILOSOPHERS: &[&str] =\n" -" &[\"Socrates\", \"Plato\", \"Aristotle\", \"Thales\", \"Pythagoras\"];\n" +" &[\"Socrates\", \"Hypatia\", \"Plato\", \"Aristotle\", \"Pythagoras\"];\n" "\n" "#[tokio::main]\n" "async fn main() {\n" -" // ANCHOR_END: Philosopher-eat-end\n" " // Create forks\n" " let mut forks = vec![];\n" " (0..PHILOSOPHERS.len()).for_each(|_| forks.push(Arc::new(Mutex::" @@ -20715,43 +19822,26 @@ msgid "" "```" msgstr "" -#: src/exercises/concurrency/solutions-afternoon.md:121 +#: src/exercises/concurrency/solutions-afternoon.md:97 msgid "([back to exercise](chat-app.md))" msgstr "" -#: src/exercises/concurrency/solutions-afternoon.md:125 +#: src/exercises/concurrency/solutions-afternoon.md:101 msgid "" "```rust,compile_fail\n" -"// Copyright 2023 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: setup\n" "use futures_util::sink::SinkExt;\n" +"use futures_util::stream::StreamExt;\n" "use std::error::Error;\n" "use std::net::SocketAddr;\n" "use tokio::net::{TcpListener, TcpStream};\n" "use tokio::sync::broadcast::{channel, Sender};\n" "use tokio_websockets::{Message, ServerBuilder, WebsocketStream};\n" -"// ANCHOR_END: setup\n" "\n" -"// ANCHOR: handle_connection\n" "async fn handle_connection(\n" " addr: SocketAddr,\n" " mut ws_stream: WebsocketStream,\n" " bcast_tx: Sender,\n" ") -> Result<(), Box> {\n" -" // ANCHOR_END: handle_connection\n" "\n" " ws_stream\n" " .send(Message::text(\"Welcome to chat! Type a message\".into()))\n" @@ -20767,9 +19857,10 @@ msgid "" " incoming = ws_stream.next() => {\n" " match incoming {\n" " Some(Ok(msg)) => {\n" -" let msg = msg.as_text()?;\n" -" println!(\"From client {addr:?} {msg:?}\");\n" -" bcast_tx.send(msg.into())?;\n" +" if let Some(text) = msg.as_text() {\n" +" println!(\"From client {addr:?} {text:?}\");\n" +" bcast_tx.send(text.into())?;\n" +" }\n" " }\n" " Some(Err(err)) => return Err(err.into()),\n" " None => return Ok(()),\n" @@ -20780,7 +19871,6 @@ msgid "" " }\n" " }\n" " }\n" -" // ANCHOR: main\n" "}\n" "\n" "#[tokio::main]\n" @@ -20802,28 +19892,13 @@ msgid "" " });\n" " }\n" "}\n" -"// ANCHOR_END: main\n" "```" msgstr "" -#: src/exercises/concurrency/solutions-afternoon.md:210 +#: src/exercises/concurrency/solutions-afternoon.md:168 msgid "" "```rust,compile_fail\n" -"// Copyright 2023 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: setup\n" +"use futures_util::stream::StreamExt;\n" "use futures_util::SinkExt;\n" "use http::Uri;\n" "use tokio::io::{AsyncBufReadExt, BufReader};\n" @@ -20831,22 +19906,24 @@ msgid "" "\n" "#[tokio::main]\n" "async fn main() -> Result<(), tokio_websockets::Error> {\n" -" let mut ws_stream = ClientBuilder::from_uri(Uri::" -"from_static(\"ws://127.0.0.1:2000\"))\n" -" .connect()\n" -" .await?;\n" +" let (mut ws_stream, _) =\n" +" ClientBuilder::from_uri(Uri::from_static(\"ws://127.0.0.1:2000\"))\n" +" .connect()\n" +" .await?;\n" "\n" " let stdin = tokio::io::stdin();\n" " let mut stdin = BufReader::new(stdin).lines();\n" "\n" -" // ANCHOR_END: setup\n" " // Continuous loop for concurrently sending and receiving messages.\n" " loop {\n" " tokio::select! {\n" " incoming = ws_stream.next() => {\n" " match incoming {\n" -" Some(Ok(msg)) => println!(\"From server: {}\", msg." -"as_text()?),\n" +" Some(Ok(msg)) => {\n" +" if let Some(text) = msg.as_text() {\n" +" println!(\"From server: {}\", text);\n" +" }\n" +" },\n" " Some(Err(err)) => return Err(err.into()),\n" " None => return Ok(()),\n" " }\n" @@ -20865,3 +19942,107 @@ msgid "" "}\n" "```" msgstr "" + +#~ msgid "Pattern Matching (TBD)" +#~ msgstr "Desen Eşleştirme" + +#~ msgid "Comparison" +#~ msgstr "Karşılaştırma" + +#~ msgid "" +#~ "```shell\n" +#~ "sudo apt install cargo rust-src rustfmt\n" +#~ "```" +#~ msgstr "" +#~ "```shell\n" +#~ "sudo apt install cargo rust-src rustfmt\n" +#~ "```" + +#~ msgid "" +#~ "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 "" +#~ "Kodu düzenlemek için [VS Code](https://code.visualstudio.com/) " +#~ "kullanmanızı öneririz (ancak LSP uyumlu herhangi bir düzenleyici " +#~ "(editör), Rust-analyzer[3](https://rust-analyzer.github.io/) ile " +#~ "çalışır. ))." + +#~ 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 " +#~ "tradeoffs. If you prefer them, you can install the [Rust Plugin](https://" +#~ "www.jetbrains.com/rust/). Please take note that as of January 2023 " +#~ "debugging only works on the CLion version of the JetBrains IDEA suite." +#~ msgstr "" +#~ "Bazıları, kendi analizlerini yapan bununla birlikte kendi ödünleri olan " +#~ "[JetBrains](https://www.jetbrains.com/clion/) IDE ailesini kullanmayı " +#~ "sever. Tercih ederseniz [Rust Eklentisini](https://www.jetbrains.com/" +#~ "rust/) yükleyebilirsiniz. Ocak 2023 itibarıyla hata ayıklamanın yalnızca " +#~ "JetBrains IDEA paketinin CLion sürümünde çalıştığını lütfen unutmayın." + +#~ msgid "" +#~ "```shell\n" +#~ "% rustc --version\n" +#~ "rustc 1.69.0 (84c898d65 2023-04-16)\n" +#~ "% cargo --version\n" +#~ "cargo 1.69.0 (6e9a83356 2023-04-12)\n" +#~ "```" +#~ msgstr "" +#~ "```shell\n" +#~ "% rustc --version\n" +#~ "rustc 1.69.0 (84c898d65 2023-04-16)\n" +#~ "% cargo --version\n" +#~ "cargo 1.69.0 (6e9a83356 2023-04-12)\n" +#~ "```" + +#~ msgid "" +#~ "```shell\n" +#~ "$ cargo new exercise\n" +#~ " Created binary (application) `exercise` package\n" +#~ "```" +#~ msgstr "" +#~ "```shell\n" +#~ "$ cargo new exercise\n" +#~ " Created binary (application) `exercise` package\n" +#~ "```" + +#~ msgid "" +#~ "```shell\n" +#~ "$ cd exercise\n" +#~ "$ cargo run\n" +#~ " Compiling exercise v0.1.0 (/home/mgeisler/tmp/exercise)\n" +#~ " Finished dev [unoptimized + debuginfo] target(s) in 0.75s\n" +#~ " Running `target/debug/exercise`\n" +#~ "Hello, world!\n" +#~ "```" +#~ msgstr "" +#~ "```shell\n" +#~ "$ cd exercise\n" +#~ "$ cargo run\n" +#~ " Compiling exercise v0.1.0 (/home/mgeisler/tmp/exercise)\n" +#~ " Finished dev [unoptimized + debuginfo] target(s) in 0.75s\n" +#~ " Running `target/debug/exercise`\n" +#~ "Hello, world!\n" +#~ "```" + +#~ msgid "" +#~ "```shell\n" +#~ "$ cargo run\n" +#~ " Compiling exercise v0.1.0 (/home/mgeisler/tmp/exercise)\n" +#~ " Finished dev [unoptimized + debuginfo] target(s) in 0.24s\n" +#~ " Running `target/debug/exercise`\n" +#~ "Edit me!\n" +#~ "```" +#~ msgstr "" +#~ "```shell\n" +#~ "$ cargo run\n" +#~ " Compiling exercise v0.1.0 (/home/mgeisler/tmp/exercise)\n" +#~ " Finished dev [unoptimized + debuginfo] target(s) in 0.24s\n" +#~ " Running `target/debug/exercise`\n" +#~ "Edit me!\n" +#~ "```" + +#, fuzzy +#~ msgid "Extra Work in Modern C++" +#~ msgstr "Modern C++'da Çifte Serbestlik"