diff --git a/po/tr.po b/po/tr.po index 2b2b207cb66a..13c617035dda 100644 --- a/po/tr.po +++ b/po/tr.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: Comprehensive Rust 🦀\n" -"POT-Creation-Date: 2025-09-05T21:05:34+03:00\n" -"PO-Revision-Date: 2025-07-19 00:57+0300\n" +"POT-Creation-Date: 2025-11-15T12:48:01+03:00\n" +"PO-Revision-Date: 2025-11-16 19: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.6\n" +"X-Generator: Poedit 3.8\n" #: src/SUMMARY.md src/index.md msgid "Welcome to Comprehensive Rust 🦀" @@ -190,7 +190,7 @@ msgstr "Dizi Adımlama (Iteration)" #: src/SUMMARY.md src/tuples-and-arrays.md #: src/tuples-and-arrays/destructuring.md msgid "Patterns and Destructuring" -msgstr "Desenler ve Çözümlenme (Destructuring)" +msgstr "Desenler ve Ayrıştırma (Destructuring)" #: src/SUMMARY.md src/tuples-and-arrays.md src/tuples-and-arrays/exercise.md msgid "Exercise: Nested Arrays" @@ -207,7 +207,7 @@ msgstr "Paylaşılan (Shared) Referanslar" #: src/SUMMARY.md src/references.md src/references/exclusive.md msgid "Exclusive References" -msgstr "Özel (Exclusive) Referanslar" +msgstr "Dışlayan (Exclusive) Referanslar" #: src/SUMMARY.md src/references.md src/references/slices.md msgid "Slices" @@ -280,11 +280,11 @@ msgstr "Değerleri Eşleştirmek" #: src/SUMMARY.md src/pattern-matching.md msgid "Destructuring Structs" -msgstr "Yapıların Çözümlenmesi (Destructuring Structs)" +msgstr "Yapıları Ayrıştırma (Destructuring Structs)" #: src/SUMMARY.md src/pattern-matching.md msgid "Destructuring Enums" -msgstr "Enum'ların Çözümlenmesi (Destructuring)" +msgstr "Enum'ları Ayrıştırma (Destructuring)" #: src/SUMMARY.md src/pattern-matching.md #: src/pattern-matching/let-control-flow.md @@ -357,7 +357,7 @@ msgstr "Özellik (Trait) Sınırları" msgid "Generic Data Types" msgstr "Genelleştirilmiş (Generic) Veri Türleri" -#: src/SUMMARY.md src/generics/generic-traits.md +#: src/SUMMARY.md src/generics.md src/generics/generic-traits.md msgid "Generic Traits" msgstr "Genelleştirilmiş (Generic) Özellikler (Traits)" @@ -575,9 +575,25 @@ msgstr "Alıştırma: Sağlık İstatistikleri" msgid "Lifetimes" msgstr "Ömürler (Lifetimes)" -#: src/SUMMARY.md src/lifetimes.md src/lifetimes/lifetime-annotations.md -msgid "Lifetime Annotations" -msgstr "Ömür için Ek Açıklamalar (Annotations)" +#: src/SUMMARY.md src/lifetimes.md +msgid "Borrowing and Functions" +msgstr "Ödünç Alma (Borrowing) ve Fonksiyonlar" + +#: src/SUMMARY.md src/lifetimes.md src/lifetimes/returning-borrows.md +msgid "Returning Borrows" +msgstr "Ödünç Alınanları Geri Döndürmek (Return)" + +#: src/SUMMARY.md src/lifetimes.md src/lifetimes/multiple-borrows.md +msgid "Multiple Borrows" +msgstr "Çoklu Ödünç Almalar" + +#: src/SUMMARY.md src/lifetimes.md src/lifetimes/borrow-both.md +msgid "Borrow Both" +msgstr "Her İkisini Birden Ödünç Al" + +#: src/SUMMARY.md src/lifetimes.md src/lifetimes/borrow-one.md +msgid "Borrow One" +msgstr "Yalnızca Birini Ödünç Al" #: src/SUMMARY.md src/lifetimes.md msgid "Lifetime Elision" @@ -812,7 +828,7 @@ msgstr "API'yi Değiştirme" #: src/SUMMARY.md msgid "Updating Implementations" -msgstr "Uyarlamaları Güncellenme" +msgstr "Gerçekleştirimleri (Implementations) Güncellenme" #: src/SUMMARY.md msgid "AIDL Types" @@ -1417,80 +1433,209 @@ msgstr "Yayımlamalı Sohbet Uygulaması" #: src/SUMMARY.md src/running-the-course/course-structure.md msgid "Idiomatic Rust" -msgstr "" +msgstr "Rust’ta Tavsiye Edilen Pratikler (Idiomatic)" #: src/SUMMARY.md src/idiomatic/welcome.md #: src/idiomatic/leveraging-the-type-system.md msgid "Leveraging the Type System" -msgstr "" +msgstr "Tür Sistemini (Type System) Etkin Kullanmak" #: src/SUMMARY.md src/idiomatic/leveraging-the-type-system.md #: src/idiomatic/leveraging-the-type-system/newtype-pattern.md -#, fuzzy msgid "Newtype Pattern" -msgstr "Tür Durum Deseni" +msgstr "Yeni Tür (Newtype) Deseni" #: src/SUMMARY.md #: src/idiomatic/leveraging-the-type-system/newtype-pattern/semantic-confusion.md msgid "Semantic Confusion" -msgstr "" +msgstr "Anlamsal Karışıklık" #: src/SUMMARY.md #: src/idiomatic/leveraging-the-type-system/newtype-pattern/parse-don-t-validate.md msgid "Parse, Don't Validate" -msgstr "" +msgstr "Ayrıştır, Doğrulama Yapma" #: src/SUMMARY.md -#, fuzzy msgid "Is It Encapsulated?" -msgstr "Kapsülleme (Encapsulation)" +msgstr "O Kapsülleme (Encapsulation) mi?" + +#: src/SUMMARY.md src/idiomatic/leveraging-the-type-system.md +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "Extension Traits" +msgstr "Genişletme Özellikleri (Extension Trait)" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md +msgid "Extending Foreign Types" +msgstr "Yabancı (Foreing) Türlerin Genişletilmesi (Extend)" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "Method Resolution Conflicts" +msgstr "Metot İsmi Çözümlemesinde (Resolution) Çatışmalar (Conflict)" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/trait-method-conflicts.md +msgid "Trait Method Conflicts" +msgstr "Özellik Metodunda (Trait Method) İsim Çatışmaları" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "Extending Other Traits" +msgstr "Diğer Özelliklerin (Traits) Genişletilmesi" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/should-i-define-an-extension-trait.md +msgid "Should I Define An Extension Trait?" +msgstr "Bir Genişletme Özelliği (Extension Trait) Tanımlamalı mıyım?" + +#: src/SUMMARY.md src/idiomatic/leveraging-the-type-system.md +msgid "Typestate Pattern" +msgstr "Tür Durum (Typestate) Deseni" + +#: src/SUMMARY.md +msgid "Typestate Pattern Example" +msgstr "Tür Durum Deseni Örneği" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "Beyond Simple Typestate" +msgstr "Basit Tür Durumunun Ötesi" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics.md +msgid "Typestate Pattern with Generics" +msgstr "Genelleştirmelerle (Generic) Tür Durum Deseni" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/root.md +msgid "Serializer: implement Root" +msgstr "Serializer: Root'u Gerçekleştirin (Implement)" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/struct.md +msgid "Serializer: implement Struct" +msgstr "Serializer: Struct'ı Gerçekleştirin" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/property.md +msgid "Serializer: implement Property" +msgstr "Serializer: Property'i Gerçekleştirin" + +#: src/SUMMARY.md +msgid "Serializer: Complete implementation" +msgstr "Serializer: Gerçekleştirimi Tamamlayın" + +#: src/SUMMARY.md src/idiomatic/leveraging-the-type-system.md +msgid "Borrow checking invariants" +msgstr "Ödünç Alma Denetimi Kuralları" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "Lifetimes and Borrows: the Abstract Rules" +msgstr "Ömürler ve Ödünçler: Soyut Kurallar" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "Single-use values" +msgstr "Tek kullanımlık değerler" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "Mutually Exclusive References / \"Aliasing XOR Mutability\"" +msgstr "" +"Birbirini Dışlayan (Mutually Exclusive) Referanslar / \"Örtüşme (Aliasing) " +"YA DA Değiştirilebilirlik (Mutability)\"" + +#: src/SUMMARY.md +msgid "PhantomData and Types" +msgstr "PhantomData ve Türler" + +#: src/SUMMARY.md +msgid "PhantomData and Types (implementation)" +msgstr "PhantomData ve Türler (Gerçekleştirim)" + +#: src/SUMMARY.md +msgid "PhantomData: Lifetimes for External Resources" +msgstr "PhantomData: Harici Kaynaklar için Ömürler" + +#: src/SUMMARY.md +msgid "PhantomData: OwnedFd & BorrowedFd" +msgstr "PhantomData: OwnedFd & BorrowedFd" + +#: src/SUMMARY.md src/idiomatic/leveraging-the-type-system.md +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "Token Types" +msgstr "Jeton Türler (Token Types)" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/token-types/permission-tokens.md +msgid "Permission Tokens" +msgstr "İzin Jetonları" + +#: src/SUMMARY.md +#: src/idiomatic/leveraging-the-type-system/token-types/mutex-guard.md +msgid "Token Types with Data: Mutex Guards" +msgstr "Veri İçeren Jeton Türleri : Mutex Filtreleri" + +#: src/SUMMARY.md +msgid "Branded pt 1: Variable-specific tokens" +msgstr "Etiketleme (Branded) Kısım 1: Değişkene özgü jetonlar" + +#: src/SUMMARY.md +msgid "Branded pt 2: `PhantomData` and Lifetime Subtyping" +msgstr "" +"Etiketleme Kısım 2: `PhantomData` ve Ömür Alttürlemesi (Lifetime Subtyping)" + +#: src/SUMMARY.md +msgid "Branded pt 3: Implementation" +msgstr "Etiketleme Kısım 3: Gerçekleştirim (Implementation)" + +#: src/SUMMARY.md +msgid "Branded pt 4: Branded types in action." +msgstr "Etiketleme Kısım 4: Pratikteki Etiketli Türler." #: src/SUMMARY.md src/running-the-course/course-structure.md #: src/unsafe-deep-dive/motivations.md -#, fuzzy msgid "Motivations" -msgstr "Motivasyon" +msgstr "Motivasyonlar" #: src/SUMMARY.md src/unsafe-deep-dive/motivations.md #: src/unsafe-deep-dive/motivations/data-structures.md -#, fuzzy msgid "Data Structures" -msgstr "Veri Yapılarında Ömürler" +msgstr "Veri Yapıları" #: src/SUMMARY.md src/unsafe-deep-dive/motivations.md #: src/unsafe-deep-dive/motivations/performance.md msgid "Performance" -msgstr "" +msgstr "Performans" #: src/SUMMARY.md src/running-the-course/course-structure.md #: src/unsafe-deep-dive/foundations.md -#, fuzzy msgid "Foundations" -msgstr "Fonksiyonlar" +msgstr "Temeller" #: src/SUMMARY.md src/unsafe-deep-dive/foundations.md -#, fuzzy msgid "What is unsafe?" -msgstr "Rust Nedir?" +msgstr "Emniyetsiz olan (unsafe) nedir?" #: src/SUMMARY.md src/unsafe-deep-dive/foundations.md #: src/unsafe-deep-dive/foundations/when-is-unsafe-used.md msgid "When is unsafe used?" -msgstr "" +msgstr "Emniyetsiz (unsafe) anahtar kelimesi ne zaman kullanılır?" #: src/SUMMARY.md src/unsafe-deep-dive/foundations.md -#, fuzzy msgid "Data structures are safe" -msgstr "Default, yapı güncelleme sözdizimi (struct update syntax)" +msgstr "Veri yapıları emniyetlidir" #: src/SUMMARY.md src/unsafe-deep-dive/foundations.md msgid "Actions might not be" -msgstr "" +msgstr "İşlemler olmayabilir" #: src/SUMMARY.md src/unsafe-deep-dive/foundations.md #: src/unsafe-deep-dive/foundations/less-powerful.md msgid "Less powerful than it seems" -msgstr "" +msgstr "Göründüğünden daha az güçlü" #: src/SUMMARY.md msgid "Final Words" @@ -1611,14 +1756,14 @@ msgstr "" #: src/index.md msgid "" -"[Chromium](chromium.md): a half-day course on using Rust within Chromium " -"based browsers. This includes interoperability with C++ and how to include " -"third-party crates in Chromium." +"[Chromium](chromium.md): a half-day course on using Rust in Chromium-based " +"browsers. This includes interoperability with C++ and how to include third-" +"party crates in Chromium." msgstr "" "[Chromium](chromium.md): Rust'ın Chromium tabanlı tarayıcılarda " "kullanılmasına ilişkin yarım günlük bir kurs. Bu, C++ ile birlikte " -"çalışabilirliği ve üçüncü taraf kasaların Chromium'a nasıl dahil edileceğini " -"içerir." +"çalışabilirliği ve üçüncü taraf kasaların (crate) Chromium'a nasıl dahil " +"edileceğini içerir." #: src/index.md msgid "" @@ -1626,7 +1771,7 @@ msgid "" "(embedded) development. Both microcontrollers and application processors are " "covered." msgstr "" -"[Yalın-metal](bare-metal.md): Yalın sistem (gömülü) geliştirme için Rust'ın " +"[Yalın-sistem](bare-metal.md): Yalın sistem (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." @@ -1828,6 +1973,87 @@ msgstr "" "isteriz. Öğrencileriniz de [bize geri bildirim gönderebilir](https://github." "com/google/comprehensive-rust/discussions/100)!" +#: src/running-the-course.md +msgid "Instructor Preparation" +msgstr "Eğitmen Hazırlığı" + +#: src/running-the-course.md +msgid "" +"**Go through all the material:** Before teaching the course, make sure you " +"have gone through all the slides and exercises yourself. This will help you " +"anticipate questions and potential difficulties." +msgstr "" +"**Tüm materyalleri gözden geçirin:** Kursu vermeden önce, tüm slaytları ve " +"alıştırmaları kendinizin de incelediğinden emin olun. Bu, soruları ve olası " +"zorlukları önceden tahmin etmenize yardımcı olacaktır." + +#: src/running-the-course.md +msgid "" +"**Prepare for live coding:** The course involves a lot of live coding. " +"Practice the examples and exercises beforehand to ensure you can type them " +"out smoothly during the class. Have the solutions ready in case you get " +"stuck." +msgstr "" +"**Canlı kodlama (live coding) için hazırlanın:** Kurs sırasında çok sayıda " +"canlı kodlama yapılacaktır. Örnekleri ve alıştırmaları önceden çalışarak " +"sınıfta rahatça yazabileceğinizden emin olun. Takılırsanız çözüm yollarını " +"hazır bulundurun." + +#: src/running-the-course.md +msgid "" +"**Familiarize yourself with `mdbook`:** The course is presented using " +"`mdbook`. Knowing how to navigate, search, and use its features will make " +"the presentation smoother." +msgstr "" +"**`mdbook` ile tanışın:** Kurs, `mdbook` kullanılarak sunulmaktadır. Nasıl " +"gezileceğini, arama yapılacağını ve özelliklerinin nasıl kullanılacağını " +"bilmek sunumu daha akıcı hâle getirecektir." + +#: src/running-the-course.md +msgid "" +"**Slice size helper:** Press Ctrl + Alt + B " +"to toggle a visual guide showing the amount of space available when " +"presenting. Expect any content outside of the red box to be hidden " +"initially. Use this as a guide when editing slides. You can also [enable it " +"via this link](?show-red-box=true)." +msgstr "" +"**Dilim (slice) boyut yardımcısı:** Sunum sırasında mevcut alanı görsel " +"olarak göstermek için Ctrl + Alt + B " +"tuşlarına basın. Kırmızı kutunun dışındaki içerik başlangıçta gizli " +"olacaktır. Slaytları düzenlerken bunu bir rehber olarak kullanabilirsiniz. " +"Ayrıca [bu bağlantı üzerinden de etkinleştirebilirsiniz](?show-red-box=true)." + +#: src/running-the-course.md +msgid "Creating a Good Learning Environment" +msgstr "İyi Bir Öğrenme Ortamı Yaratmak" + +#: src/running-the-course.md +msgid "" +"**Encourage questions:** Reiterate that there are no \"stupid\" questions. A " +"welcoming atmosphere for questions is crucial for learning." +msgstr "" +"**Soru sormayı teşvik edin:** \"Aptalca\" soru diye bir şey olmadığını " +"vurgulayın. Soru sormaya açık bir ortam, öğrenme için çok önemlidir." + +#: src/running-the-course.md +msgid "" +"**Manage time effectively:** Keep an eye on the schedule, but be flexible. " +"It's more important that students understand the concepts than sticking " +"rigidly to the timeline." +msgstr "" +"**Zamanı etkili bir şekilde yönetin:** Programı takip edin, ancak esnek " +"olun. Öğrencilerin konuları anlamaları, zaman çizelgesine sıkı sıkıya bağlı " +"kalmaktan daha önemlidir." + +#: src/running-the-course.md +msgid "" +"**Facilitate group work:** During exercises, encourage students to work " +"together. This can help them learn from each other and feel less stuck." +msgstr "" +"**Grup çalışmasını kolaylaştırın:** Alıştırmalar sırasında öğrencileri " +"birlikte çalışmaya teşvik edin. Bu, birbirlerinden öğrenmelerine ve " +"kendilerini daha az sıkışmış hissetmelerine yardımcı olabilir." + #: src/running-the-course/course-structure.md msgid "Rust Fundamentals" msgstr "Rust Esasları" @@ -1835,10 +2061,10 @@ msgstr "Rust Esasları" #: src/running-the-course/course-structure.md msgid "" "The first four days make up [Rust Fundamentals](../welcome-day-1.md). The " -"days are fast paced and we cover a lot of ground!" +"days are fast-paced and we cover a lot of ground!" msgstr "" "İlk dört gün [Rust Temelleri](../welcome-day-1.md)'ni oluşturur. Günler " -"hızlı geçiyor ve çok fazla yol kat ediyoruz!" +"hızlı geçiyor ve çok geniş bir konuyu kapsıyoruz!" #: src/running-the-course/course-structure.md msgid "Course schedule:" @@ -1929,20 +2155,19 @@ msgid "1 hour" msgstr "1 saat" #: src/running-the-course/course-structure.md -msgid "Day 2 Morning (2 hours and 45 minutes, including breaks)" -msgstr "2. Gün Sabah (2 saat 45 dakika, aralar dahil)" +msgid "Day 2 Morning (2 hours and 50 minutes, including breaks)" +msgstr "2. Gün Sabah (2 saat 50 dakika, aralar dahil)" #: src/running-the-course/course-structure.md src/hello-world.md #: src/types-and-values.md src/control-flow-basics.md src/tuples-and-arrays.md #: src/references.md src/welcome-day-2.md src/methods-and-traits.md #: src/closures.md src/std-types.md src/welcome-day-3.md src/borrowing.md -#: src/welcome-day-4.md src/iterators.md src/modules.md src/testing.md -#: src/error-handling.md +#: src/lifetimes.md src/welcome-day-4.md src/iterators.md src/modules.md +#: src/testing.md src/error-handling.md msgid "3 minutes" msgstr "3 dakika" #: src/running-the-course/course-structure.md src/welcome-day-2.md -#: src/welcome-day-3-afternoon.md msgid "50 minutes" msgstr "50 dakika" @@ -1954,6 +2179,7 @@ msgstr "2. Gün Öğleden Sonra (2 saat 50 dakika, aralar dahil)" #: src/std-traits.md src/smart-pointers.md src/lifetimes.md src/iterators.md #: src/testing.md src/unsafe-rust.md src/concurrency/welcome.md #: src/concurrency/sync-exercises.md src/concurrency/async-exercises.md +#: src/idiomatic/leveraging-the-type-system.md msgid "30 minutes" msgstr "30 dakika" @@ -1962,8 +2188,13 @@ msgid "Day 3 Morning (2 hours and 20 minutes, including breaks)" msgstr "3. Gün Sabah (2 saat 20 dakika, aralar dahil)" #: src/running-the-course/course-structure.md -msgid "Day 3 Afternoon (1 hour and 55 minutes, including breaks)" -msgstr "3. Gün Öğleden Sonra (1 saat 55 dakika, aralar dahil)" +msgid "Day 3 Afternoon (2 hours and 10 minutes, including breaks)" +msgstr "3. Gün Öğleden Sonra (2 saat 10 dakika, aralar dahil)" + +#: src/running-the-course/course-structure.md src/welcome-day-3-afternoon.md +#: src/idiomatic/leveraging-the-type-system.md +msgid "1 hour and 5 minutes" +msgstr "1 saat 5 dakika" #: src/running-the-course/course-structure.md msgid "Day 4 Morning (2 hours and 50 minutes, including breaks)" @@ -2047,15 +2278,14 @@ msgstr "" "çalışabilirliğini içerir." #: src/running-the-course/course-structure.md -#, fuzzy msgid "" "You will need to be able to build Chromium --- a debug, component build is " "[recommended](../chromium/setup.md) for speed but any build will work. " "Ensure that you can run the Chromium browser that you've built." msgstr "" -"Chromium'u inşa etmeniz gerekecek --- bir hata ayıklama, hız için bileşen " -"derlemesi [önerilir](../chromium/setup.md), ancak herhangi bir inşa işlemi " -"işe yarayacaktır. İnşa ettiğiniz Chromium tarayıcısını " +"Chromium'u derleyebiliyor olmanız gerekecek --- hız için bir debug, " +"component inşası (build) [önerilir](../chromium/setup.md), ancak herhangi " +"bir inşa işlemi de işe yarayacaktır. İnşa ettiğiniz Chromium tarayıcısını " "çalıştırabildiğinizden emin olun." #: src/running-the-course/course-structure.md @@ -2134,28 +2364,29 @@ msgid "Afternoon (3 hours and 30 minutes, including breaks)" msgstr "Öğleden Sonra (3 saat 30 dakika, aralar dahil)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "" "The [Idiomatic Rust](../idiomatic/welcome.md) deep dive is a 2-day class on " "Rust idioms and patterns." msgstr "" -"[Rust'ta Eşzamanlılık](../concurrency/welcome.md) ayrıntılı incelemesi, " -"klasik ve aynı zamanda `async`/`await` eşzamanlılığı üzerine tam günlük bir " -"derstir." +"[Rust’ta Tavsiye Edilen Pratikler (Idiomatic)](../idiomatic/welcome.md) " +"derinlemesine incelemesi,Rust kod kalıpları (idiom) ve desenleri üzerine 2 " +"günlük bir derstir." #: src/running-the-course/course-structure.md msgid "" "You should be familiar with the material in [Rust Fundamentals](../welcome-" "day-1.md) before starting this course." msgstr "" +"Bu kursa başlamadan önce [Rust Temelleri](../welcome-day-1.md) dersindeki " +"materyale aşina olmanız gerekir." #: src/running-the-course/course-structure.md msgid "course outline Idiomatic Rust" -msgstr "" +msgstr "ders planı Rust’ta Tavsiye Edilen Pratikler (Idiomatic)" #: src/running-the-course/course-structure.md msgid "Unsafe (Work in Progress)" -msgstr "" +msgstr "Emniyetsiz Rust (Devam Eden Çalışma)" #: src/running-the-course/course-structure.md msgid "" @@ -2165,11 +2396,15 @@ msgid "" "FFI basics, and building data structures that the borrow checker would " "normally reject." msgstr "" +"[Emniyetsiz Rust](../unsafe-deep-dive/welcome.md) derinlemesine incelemesi, " +"_unsafe_ Rust dili üzerine iki günlük bir sınıftır. Rust'ın emniyet " +"garantilerinin temellerini, `unsafe` motivasyonunu, `unsafe` kod için " +"inceleme (review) sürecini, FFI temellerini ve ödünç alma denetleyicisinin " +"(borrow checker) normalde reddedeceği veri yapılarını oluşturmayı kapsar." #: src/running-the-course/course-structure.md -#, fuzzy msgid "Day 1 Morning (1 hour, including breaks)" -msgstr "2. Gün Öğleden Sonra (4 saat, aralar dahil)" +msgstr "1. Gün Sabah (1 saat, aralar dahil)" #: src/running-the-course/course-structure.md src/hello-world.md #: src/control-flow-basics.md src/user-defined-types.md @@ -2178,10 +2413,9 @@ msgstr "2. Gün Öğleden Sonra (4 saat, aralar dahil)" msgid "2 minutes" msgstr "2 dakika" -#: src/running-the-course/course-structure.md src/idiomatic/welcome.md -#, fuzzy +#: src/running-the-course/course-structure.md msgid "25 minutes" -msgstr "5 dakika" +msgstr "25 dakika" #: src/running-the-course/course-structure.md msgid "Format" @@ -2208,13 +2442,42 @@ msgid "Arrow-Right: Navigate to the next page." msgstr "Arrow-Right: Sonraki sayfaya gidin." #: src/running-the-course/keyboard-shortcuts.md -msgid "Ctrl + Enter: Execute the code sample that has focus." -msgstr "Ctrl + Enter: Odaklı kod örneğini yürütün." +msgid "" +"Ctrl + Enter: Execute the code sample that has focus." +msgstr "Ctrl + Enter: Odaklı kod örneğini yürütün." #: src/running-the-course/keyboard-shortcuts.md msgid "s: Activate the search bar." msgstr "s: Arama çubuğunu etkinleştirin." +#: src/running-the-course/keyboard-shortcuts.md +msgid "" +"Mention that these shortcuts are standard for `mdbook` and can be useful " +"when navigating any `mdbook`\\-generated site." +msgstr "" +"Bu kısayolların `mdbook` için standart olduğunu ve `mdbook` tarafından " +"oluşturulan herhangi bir sitede gezinirken yararlı olabileceğini belirtin." + +#: src/running-the-course/keyboard-shortcuts.md +msgid "You can demonstrate each shortcut live to the students." +msgstr "Her kısayolu öğrencilere canlı olarak gösterebilirsiniz." + +#: src/running-the-course/keyboard-shortcuts.md +msgid "" +"The s key for search is particularly useful for quickly finding " +"topics that have been discussed earlier." +msgstr "" +"Arama için s tuşu, daha önce tartışılan konuları hızlıca bulmak " +"için özellikle yararlıdır." + +#: src/running-the-course/keyboard-shortcuts.md +msgid "" +"Ctrl + Enter will be super important for you since " +"you'll do a lot of live coding." +msgstr "" +"Canlı kodlamayı çok fazla yapacağınız için Ctrl + Enter sizin için çok önemli olacak." + #: src/running-the-course/translations.md msgid "" "The course has been translated into other languages by a set of wonderful " @@ -2406,6 +2669,31 @@ msgstr "" "main/TRANSLATIONS.md) bakın. Çeviriler [sorun izleyicide](https://github.com/" "google/comprehensive-rust/issues/282) üzerinde koordine edilir." +#: src/running-the-course/translations.md +msgid "" +"This is a good opportunity to thank the volunteers who have contributed to " +"the translations." +msgstr "" +"Çevirilere katkıda bulunan gönüllülere teşekkür etmek için iyi bir fırsat." + +#: src/running-the-course/translations.md +msgid "" +"If there are students in the class who speak any of the listed languages, " +"you can encourage them to check out the translated versions and even " +"contribute if they find any issues." +msgstr "" +"Eğer sınıfta listelenen dillerden herhangi birini konuşan öğrenciler varsa, " +"onları çevrilmiş versiyonları kontrol etmeye ve hatta herhangi bir sorun " +"bulurlarsa katkıda bulunmaya teşvik edebilirsiniz." + +#: src/running-the-course/translations.md +msgid "" +"Highlight that the project is open source and contributions are welcome, not " +"just for translations but for the course content itself." +msgstr "" +"Projenin açık kaynaklı olduğunu ve yalnızca çeviriler için değil, ders " +"içeriğinin kendisi için de katkıların memnuniyetle karşılandığını vurgulayın." + #: src/cargo.md msgid "" "When you start reading about Rust, you will soon meet [Cargo](https://doc." @@ -2432,12 +2720,12 @@ msgstr "**Lütfen adresindeki talimatları izleyin.**" 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 to different compiler versions." +"use to install 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." +"Bu size Cargo derleme aracını (`cargo`) ve Rust derleyicisini (`rustc`) " +"verecektir. Ayrıca farklı derleyici sürümlerini yüklemek için " +"kullanabileceğiniz bir komut satırı yardımcı programı olan `rustup`'ı da " +"alacaksınız." #: src/cargo.md msgid "" @@ -2460,7 +2748,7 @@ msgstr "" #: src/cargo.md msgid "On Debian/Ubuntu, you can install `rustup` via `apt`:" -msgstr "" +msgstr "Debian/Ubuntu'da `rustup`'ı `apt` yoluyla kurabilirsiniz:" #: src/cargo.md msgid "" @@ -2484,7 +2772,7 @@ msgstr "" #: src/cargo/rust-ecosystem.md msgid "" -"`rustc`: the Rust compiler which turns `.rs` files into binaries and other " +"`rustc`: the Rust compiler that turns `.rs` files into binaries and other " "intermediate formats." msgstr "" "`rustc`: `.rs` dosyalarını ikili (binary) dosyalara ve diğer ara biçimlere " @@ -2673,13 +2961,12 @@ msgstr "" #: src/cargo/code-samples.md msgid "" "Installing Cargo is still encouraged: it will make it easier for you to do " -"the exercises. On the last day, we will do a larger exercise which shows you " +"the exercises. On the last day, we will do a larger exercise that shows you " "how to work with dependencies and for that you need Cargo." msgstr "" -"Cargo'nun kurulumu hala teşvik edilmektedir: alıştırmaları 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." +"Cargo'yu kurmanız hâlâ tavsiye edilir: Alıştırmaları yapmanızı " +"kolaylaştıracaktır. Son gün, bağımlılıklarla nasıl çalışacağınızı gösteren " +"daha kapsamlı bir alıştırma yapacağız ve bunun için Cargo'ya ihtiyacınız var." #: src/cargo/code-samples.md msgid "The code blocks in this course are fully interactive:" @@ -2691,11 +2978,11 @@ msgstr "\"Düzenle beni!\"" #: src/cargo/code-samples.md msgid "" -"You can use Ctrl + Enter to execute the code when focus is in the " -"text box." +"You can use Ctrl + Enter to execute the code when " +"focus is in the text box." msgstr "" -"Metin kutusu odaklanmışken kodu çalıştırmak için Ctrl + Enter " -"tuşlarını kullanabilirsiniz." +"Metin kutusuna odaklanıldığında kodu çalıştırmak için Ctrl + " +"Enter tuşlarını kullanabilirsiniz." #: src/cargo/code-samples.md msgid "" @@ -2780,12 +3067,12 @@ msgstr "" #: src/cargo/running-locally.md msgid "" -"Replace the boiler-plate code in `src/main.rs` with your own code. For " +"Replace the boilerplate 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/main.rs` dosyasındaki standart kodu kendi kodunuzla değiştirin. " +"Örneğin, önceki sayfadaki örneği kullanarak `src/main.rs` dosyasını şu " +"şekilde yapın" #: src/cargo/running-locally.md msgid "Use `cargo run` to build and run your updated binary:" @@ -2863,7 +3150,7 @@ msgstr "" msgid "Schedule" msgstr "Zamanlama (Schedule)" -#: src/welcome-day-1.md +#: src/welcome-day-1.md src/welcome-day-3-afternoon.md msgid "" "Including 10 minute breaks, this session should take about 2 hours and 10 " "minutes. It contains:" @@ -2890,9 +3177,10 @@ msgstr "" #: src/welcome-day-1.md msgid "" "As an instructor, you should try to keep the discussions relevant, i.e., " -"keep the discussions related to how Rust does things vs some other language. " -"It can be hard to find the right balance, but err on the side of allowing " -"discussions since they engage people much more than one-way communication." +"keep the discussions related to how Rust does things vs. some other " +"language. It can be hard to find the right balance, but err on the side of " +"allowing discussions since they engage people much more than one-way " +"communication." msgstr "" "Bir eğitmen olarak tartışmaları güncel tutmaya çalışmalısınız, yani Rust'ın " "işi nasıl yaptığı ve başka bir dilin işi nasıl yaptığıyla ilgili " @@ -2964,8 +3252,8 @@ msgstr "Slayt" #: src/hello-world.md src/references.md src/user-defined-types.md #: src/pattern-matching.md src/methods-and-traits.md src/generics.md #: src/closures.md src/std-types.md src/memory-management.md -#: src/smart-pointers.md src/borrowing.md src/lifetimes.md src/modules.md -#: src/unsafe-rust.md src/concurrency/channels.md src/concurrency/send-sync.md +#: src/smart-pointers.md src/borrowing.md src/modules.md src/unsafe-rust.md +#: src/concurrency/channels.md src/concurrency/send-sync.md #: src/concurrency/shared-state.md src/concurrency/async.md #: src/concurrency/async-control-flow.md src/concurrency/async-pitfalls.md #: src/unsafe-deep-dive/foundations.md @@ -2974,7 +3262,7 @@ msgstr "10 dakika" #: src/hello-world/what-is-rust.md msgid "" -"Rust is a new programming language which had its [1.0 release in 2015]" +"Rust is a new programming language that had its [1.0 release in 2015]" "(https://blog.rust-lang.org/2015/05/15/Rust-1.0.html):" msgstr "" "Rust, [2015'te 1.0 sürümü](https://blog.rust-lang.org/2015/05/15/Rust-1.0." @@ -3284,10 +3572,8 @@ msgid "Statements end with `;`." msgstr "Deyimler (Statements) `;` ile biter." #: src/types-and-values/hello-world.md -msgid "Rust has hygienic macros, `println!` is an example of this." -msgstr "" -"Rust arınmış/pak/izole (hygienic) makrolara sahiptir, `println!` buna bir " -"örnektir." +msgid "`println` is a macro, indicated by the `!` in the invocation." +msgstr "`println` bir makrodur ve çağrısı için `!` gerekir." #: src/types-and-values/hello-world.md msgid "Rust strings are UTF-8 encoded and can contain any Unicode character." @@ -3315,9 +3601,8 @@ msgstr "" "keşfetmeye çalışmaz." #: src/types-and-values/hello-world.md -msgid "Rust is modern with full support for things like Unicode." -msgstr "" -"Rust, Unicode gibi şeyleri tam olarak destekleyen modern bir yazılımdır." +msgid "Rust is modern with full support for Unicode." +msgstr "Rust, Ünikodu tam olarak destekleyen modern bir dildir." #: src/types-and-values/hello-world.md msgid "" @@ -3330,15 +3615,13 @@ msgstr "" #: src/types-and-values/hello-world.md msgid "" -"Macros being 'hygienic' means they don't accidentally capture identifiers " -"from the scope they are used in. Rust macros are actually only [partially " -"hygienic](https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene." -"html)." +"`println!` is a macro because it needs to handle an arbitrary number of " +"arguments based on the format string, which can't be done with a regular " +"function. Otherwise it can be treated like a regular function." msgstr "" -"Makroların 'arınmış/pak' olması, kullanıldıkları kapsamdaki (scope) " -"tanımlayıcıları (identifiers) yanlışlıkla yakalamadıkları anlamına gelir. " -"Rust makroları aslında yalnızca [kısmi paktır (hygienic)](https://veykril." -"github.io/tlborm/decl-macros/minutiae/hygiene.html)." +"`println!` bir makrodur çünkü biçim dizesine (format string) dayalı olarak " +"rastgele sayıda argümanı işlemesi gerekir; bu da normal bir fonksiyonla " +"yapılamaz. Aksi takdirde normal bir fonksiyon gibi ele alınabilir." #: src/types-and-values/hello-world.md msgid "" @@ -3499,7 +3782,7 @@ msgid "`bool` is 8 bits wide." msgstr "`bool` türü 8 bit genişliğinde." #: src/types-and-values/values.md -msgid "There are a few syntaxes which are not shown above:" +msgid "There are a few syntaxes that are not shown above:" msgstr "Yukarıda gösterilmeyen birkaç sözdizimi (syntax) vardır:" #: src/types-and-values/values.md @@ -3607,25 +3890,22 @@ msgstr "" #: src/types-and-values/inference.md msgid "// ERROR: no implementation for `{float} == {integer}`\n" msgstr "" -"// HATA: `{float} == {integer}` için gerçekleştirim-uyarlama " -"(implementation) yok\n" +"// HATA: `{float} == {integer}` için gerçekleştirim (implementation) yok\n" #: src/types-and-values/exercise.md msgid "" -"The Fibonacci sequence begins with `[0,1]`. For n>1, the n'th Fibonacci " -"number is calculated recursively as the sum of the n-1'th and n-2'th " -"Fibonacci numbers." +"The Fibonacci sequence begins with `[0, 1]`. For `n > 1`, the next number is " +"the sum of the previous two." msgstr "" -"Fibonacci dizisi `[0,1]` ile başlar. n>1 için, n'inci Fibonacci sayısı " -"yinelemeli olarak n-1'inci ve n-2'inci Fibonacci sayılarının toplamı olarak " -"hesaplanır." +"Fibonacci dizisi `[0, 1]` ile başlar. `n > 1` için bir sonraki sayı, önceki " +"ikisinin toplamıdır." #: src/types-and-values/exercise.md msgid "" -"Write a function `fib(n)` that calculates the n'th Fibonacci number. When " +"Write a function `fib(n)` that calculates the nth Fibonacci number. When " "will this function panic?" msgstr "" -"N'inci Fibonacci sayısını hesaplayan bir `fib(n)` fonksiyonu yazın. Bu " +"N'inci Fibonacci sayısını hesaplayan `fib(n)` adlı bir fonksiyon yazın. Bu " "fonksiyon ne zaman paniğe (panic) uğrar?" #: src/types-and-values/exercise.md @@ -3644,8 +3924,99 @@ msgstr "// Özyinelemeli (recursive) durum.\n" msgid "\"fib({n}) = {}\"" msgstr "\"fib({n}) = {}\"" -#: src/control-flow-basics.md src/methods-and-traits.md src/generics.md -#: src/modules.md src/testing.md +#: src/types-and-values/exercise.md +msgid "This exercise is a classic introduction to recursion." +msgstr "" +"Bu alıştırma, özyinelemeye (recursion) klasik bir giriş niteliğindedir." + +#: src/types-and-values/exercise.md +msgid "" +"Encourage students to think about the base cases and the recursive step." +msgstr "" +"Öğrencileri temel durumları ve yinelemeli adımları (recursive step) " +"düşünmeye teşvik edin." + +#: src/types-and-values/exercise.md +msgid "" +"The question \"When will this function panic?\" is a hint to think about " +"integer overflow. The Fibonacci sequence grows quickly!" +msgstr "" +"\"Bu fonksiyon ne zaman paniğe (panic) uğrar?\" sorusu, tam sayı taşması " +"(integer overflow) hakkında düşünmeniz için bir ipucudur. Fibonacci dizisi " +"hızla büyüyor!" + +#: src/types-and-values/exercise.md +msgid "" +"Students might come up with an iterative solution as well, which is a great " +"opportunity to discuss the trade-offs between recursion and iteration (e.g., " +"performance, stack overflow for deep recursion)." +msgstr "" +"Öğrenciler adımlamalı (iterative) bir çözüm de bulabilirler; bu, " +"özyinelemeli (recursion) ile adımlamalı (iteration) arasındaki dengeleri " +"(örneğin, performans, derin özyineleme için yığın taşması) tartışmak için " +"harika bir fırsattır." + +#: src/types-and-values/solution.md +msgid "Walk through the solution step-by-step." +msgstr "Çözümü adım adım uygulayın." + +#: src/types-and-values/solution.md +msgid "Explain the recursive calls and how they lead to the final result." +msgstr "" +"Özyinelemeli çağrıları ve bunların nihai sonuca nasıl yol açtığını açıklayın." + +#: src/types-and-values/solution.md +msgid "" +"Discuss the integer overflow issue. With `u32`, the function will panic for " +"`n` around 47. You can demonstrate this by changing the input to `main`." +msgstr "" +"Tamsayı taşma sorununu tartışın. `u32` ile fonksiyon, 47 civarında `n` için " +"paniğe uğrayacaktır. Bunu, girdiyi `main` olarak değiştirerek " +"gösterebilirsiniz." + +#: src/types-and-values/solution.md +msgid "" +"Show an iterative solution as an alternative and compare its performance and " +"memory usage with the recursive one. An iterative solution will be much more " +"efficient." +msgstr "" +"Alternatif olarak adımlamalı (iterative) bir çözüm gösterin ve performansını " +"ve bellek kullanımını özyinelemeli (recursive) çözümle karşılaştırın. " +"Adımlamalı (iterative) bir çözüm çok daha verimli olacaktır." + +#: src/types-and-values/solution.md src/control-flow-basics/match.md +#: src/references/dangling.md src/user-defined-types/named-structs.md +#: src/user-defined-types/enums.md src/user-defined-types/static.md +#: src/pattern-matching/infallible.md +#: src/pattern-matching/destructuring-structs.md +#: src/pattern-matching/let-control-flow/let-else.md src/closures/syntax.md +#: src/memory-management/review.md src/memory-management/move.md +#: src/memory-management/copy-types.md src/borrowing/shared.md +#: src/borrowing/borrowck.md src/borrowing/interior-mutability/refcell.md +#: src/iterators/motivation.md src/iterators/iterator.md +#: src/iterators/helpers.md src/iterators/collect.md +#: src/modules/encapsulation.md src/error-handling/result.md +#: src/error-handling/anyhow.md src/concurrency/async/state-machine.md +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "More to Explore" +msgstr "Daha Fazlasını Keşfedin" + +#: src/types-and-values/solution.md +msgid "" +"For a more advanced discussion, you can introduce memoization or dynamic " +"programming to optimize the recursive Fibonacci calculation, although this " +"is beyond the scope of the current topic." +msgstr "" +"Daha ileri bir tartışma için, özyinelemeli (recursive) Fibonacci " +"hesaplamasını optimize etmek amacıyla bellekleme (memoization) veya dinamik " +"programlama tekniklerini tanıtabilirsiniz; ancak bu, mevcut konunun kapsamı " +"dışındadır." + +#: src/control-flow-basics.md src/methods-and-traits.md src/modules.md +#: src/testing.md msgid "This segment should take about 45 minutes. It contains:" msgstr "Bu bölüm yaklaşık 45 dakika sürmelidir. İçeriği:" @@ -3682,13 +4053,17 @@ msgstr "" #: src/control-flow-basics/blocks-and-scopes.md msgid "" -"A block in Rust contains a sequence of expressions, enclosed by braces `{}`. " -"Each block has a value and a type, which are those of the last expression of " -"the block:" +"A block in Rust contains a sequence of expressions, enclosed by braces `{}`." msgstr "" "Rust dilindeki bir blok, `{}` parantezleri içine alınmış bir ifadeler dizisi " -"(sequence of expressions) içerir. Her bloğun bir değeri ve bir türü vardır, " -"bunlar, bloğun son ifadesinin değer ve türüdür:" +"(sequence of expressions) içerir." + +#: src/control-flow-basics/blocks-and-scopes.md +msgid "" +"The final expression of a block determines the value and type of the whole " +"block." +msgstr "" +"Bir bloğun son ifadesi (expression), tüm bloğun değerini ve türünü belirler." #: src/control-flow-basics/blocks-and-scopes.md msgid "// dbg!(y);\n" @@ -3890,28 +4265,13 @@ msgstr "" "aşina olma şansı veriyor. Desen eşleştirmesi hakkında yarın daha detaylı " "konuşacağız, bu yüzden burada çok fazla detaya girmemeye çalışın." -#: src/control-flow-basics/match.md src/references/dangling.md -#: src/user-defined-types/named-structs.md src/user-defined-types/enums.md -#: src/user-defined-types/static.md src/pattern-matching/infallible.md -#: src/pattern-matching/destructuring-structs.md -#: src/pattern-matching/let-control-flow/let-else.md src/closures/syntax.md -#: src/memory-management/review.md src/memory-management/move.md -#: src/memory-management/copy-types.md src/borrowing/shared.md -#: src/borrowing/borrowck.md src/borrowing/interior-mutability/refcell.md -#: src/iterators/motivation.md src/iterators/iterator.md -#: src/iterators/helpers.md src/iterators/collect.md -#: src/modules/encapsulation.md src/error-handling/result.md -#: src/error-handling/anyhow.md src/concurrency/async/state-machine.md -msgid "More to Explore" -msgstr "Daha Fazlasını Keşfedin" - #: src/control-flow-basics/match.md msgid "" "To further motivate the usage of `match`, you can compare the examples to " -"their equivalents written with `if`. In the second case matching on a `bool` " -"an `if {} else {}` block is pretty similar. But in the first example that " -"checks multiple cases, a `match` expression can be more concise than `if {} " -"else if {} else if {} else`." +"their equivalents written with `if`. In the second case, matching on a " +"`bool`, an `if {} else {}` block is pretty similar. But in the first example " +"that checks multiple cases, a `match` expression can be more concise than " +"`if {} else if {} else if {} else`." msgstr "" "`match` kullanımını daha da motive etmek için, örnekleri `if` ile yazılmış " "eşdeğerleriyle karşılaştırabilirsiniz. İkinci durumda, bir `bool` üzerinde " @@ -3991,7 +4351,7 @@ msgstr "" #: src/control-flow-basics/loops/loop.md msgid "" "The `loop` statement works like a `while true` loop. Use it for things like " -"servers which will serve connections forever." +"servers that will serve connections forever." msgstr "" "`loop` deyimi `while true` döngüsü gibi çalışır. Bağlantılara sonsuza kadar " "hizmet edecek sunucular gibi şeyler için kullanın." @@ -4018,10 +4378,10 @@ msgstr "" #: src/control-flow-basics/break-continue.md msgid "" -"Note that `loop` is the only looping construct which can return a non-" -"trivial value. This is because it's guaranteed to only return at a `break` " -"statement (unlike `while` and `for` loops, which can also return when the " -"condition fails)." +"Note that `loop` is the only looping construct that can return a non-trivial " +"value. This is because it's guaranteed to only return at a `break` statement " +"(unlike `while` and `for` loops, which can also return when the condition " +"fails)." msgstr "" "`loop`'un önemsiz olmayan (non-trivial) bir değer geri döndüren tek döngüsel " "yapı olduğunu unutmayın. Bunun nedeni, en az bir `break` ifadesinde " @@ -4030,7 +4390,7 @@ msgstr "" #: src/control-flow-basics/break-continue/labels.md msgid "" -"Both `continue` and `break` can optionally take a label argument which is " +"Both `continue` and `break` can optionally take a label argument that is " "used to break out of nested loops:" msgstr "" "Hem `continue` ve `break` isteğe bağlı olarak iç içe geçmiş döngülerden " @@ -4080,7 +4440,7 @@ msgid "" "Overloading is not supported -- each function has a single implementation." msgstr "" "Fonksiyon yüklemesi (overloading) desteklenmez -- her fonksiyonun tek bir " -"uygulaması (implementation) vardır." +"gerçekleştirimi (implementation) vardır." #: src/control-flow-basics/functions.md msgid "" @@ -4137,8 +4497,8 @@ msgid "" "`todo!()` marks a bit of code as not-yet-implemented. If executed, it will " "panic." msgstr "" -"`todo!()` kodun bir kısmını henüz uygulanmamış (not-yet-implemented) olarak " -"işaretler. Eğer yürütülürse (execute), paniğe neden olur." +"`todo!()` kodun bir kısmını henüz gerçekleştirilmemiş (not-yet-implemented) " +"olarak işaretler. Eğer yürütülürse (execute), paniğe neden olur." #: src/control-flow-basics/macros.md msgid "\"{n}! = {}\"" @@ -4163,6 +4523,7 @@ msgstr "" "bölümde `derive` makrolarının kullanımı anlatılacaktır." #: src/control-flow-basics/macros.md src/pattern-matching/match.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md msgid "More To Explore" msgstr "Daha Fazlasını Keşfedin" @@ -4264,10 +4625,10 @@ msgstr "sekans sonlandırılır." #: src/control-flow-basics/exercise.md msgid "" -"Write a function to calculate the length of the collatz sequence for a given " +"Write a function to calculate the length of the Collatz sequence for a given " "initial `n`." msgstr "" -"Belirli bir başlangıç `n` için collatz sekansının uzunluğunu hesaplayan bir " +"Belirli bir başlangıç `n` için Collatz dizisin uzunluğunu hesaplayan bir " "fonksiyon yazın." #: src/control-flow-basics/exercise.md src/control-flow-basics/solution.md @@ -4282,12 +4643,27 @@ msgstr "\"Uzunluk: {}\"" msgid "// should be 15\n" msgstr "// 15 olmalı\n" +#: src/control-flow-basics/solution.md +msgid "" +"Note that the argument `n` is marked as `mut`, allowing you to change the " +"value of `n` in the function. Like variables, function arguments are " +"immutable by default and you must add `mut` if you want to modify their " +"value. This does not affect how the function is called or how the argument " +"is passed in." +msgstr "" +"Argüman `n`’in `mut` olarak işaretlendiğine dikkat edin; bu, fonksiyon " +"içinde `n`’in değerini değiştirmenize imkân tanır. Değişkenlerde olduğu " +"gibi, fonksiyon argümanları da varsayılan olarak değiştirilemezdir " +"(immutable) ve değerlerini değiştirmek istiyorsanız `mut` eklemeniz gerekir. " +"Bu, fonksiyonun nasıl çağrıldığını veya argümanın nasıl iletildiğini " +"etkilemez." + #: src/welcome-day-1-afternoon.md src/welcome-day-2-afternoon.md #: src/welcome-day-3-afternoon.md src/welcome-day-4-afternoon.md msgid "Welcome Back" msgstr "Tekrar Hoş Geldiniz" -#: src/welcome-day-1-afternoon.md src/welcome-day-2.md +#: src/welcome-day-1-afternoon.md msgid "" "Including 10 minute breaks, this session should take about 2 hours and 45 " "minutes. It contains:" @@ -4367,6 +4743,33 @@ msgstr "" msgid "We can use literals to assign values to arrays." msgstr "Dizilere değer atamak için değişmezleri (literals) kullanabiliriz." +#: src/tuples-and-arrays/arrays.md +msgid "" +"Arrays are not heap-allocated. They are regular values with a fixed size " +"known at compile time, meaning they go on the stack. This can be different " +"from what students expect if they come from a garbage-collected language, " +"where arrays may be heap allocated by default." +msgstr "" +"Diziler dinamik bellek (heap) üzerinde tahsis edilmez. Derleme zamanında " +"(compile time) bilinen sabit bir boyuta sahip normal değerlerdir, yani " +"yığında (stack) yer alırlar. Çöp toplayıcılı (garbage-collected) bir dilden " +"gelen öğrenciler için bu beklediklerinden farklı olabilir; çünkü bu dillerde " +"diziler varsayılan olarak yığında (heap) tahsis ediliyor olabilir." + +#: src/tuples-and-arrays/arrays.md +msgid "" +"There is no way to remove elements from an array, nor add elements to an " +"array. The length of an array is fixed at compile-time, and so its length " +"cannot change at runtime." +msgstr "" +"“Bir diziden öğe çıkarmanın ya da bir diziye öğe eklemenin bir yolu yoktur. " +"Bir dizinin uzunluğu derleme zamanında sabittir ve bu nedenle çalışma " +"zamanında (runtime) değiştirilemez." + +#: src/tuples-and-arrays/arrays.md +msgid "Debug Printing" +msgstr "Hata ayıklama amacıyla çıktı verme" + #: src/tuples-and-arrays/arrays.md msgid "" "The `println!` macro asks for the debug implementation with the `?` format " @@ -4376,12 +4779,12 @@ msgid "" "here." msgstr "" "`println!` makrosu `?` biçim (format) parametresiyle hata ayıklama " -"gerçekleştirimini/uyarlamasını (implementation) ister: `{}` varsayılan " -"çıktıyı verir, `{:?}` hata ayıklama çıktısını verir. Tamsayılar (integer) ve " -"dizeler (string) gibi türler varsayılan çıktıyı uygular (default output), " -"ancak diziler (arrays) yalnızca hata ayıklama çıktısını (debug output) " -"uygular. Bu, bahsi geçen kodda hata ayıklama çıktısını kullanmamız gerektiği " -"anlamına gelir." +"gerçekleştirimini (implementation) ister: `{}` varsayılan çıktıyı verir, " +"`{:?}` hata ayıklama çıktısını verir. Tamsayılar (integer) ve dizeler " +"(string) gibi türler varsayılan çıktıyı uygular (default output), ancak " +"diziler (arrays) yalnızca hata ayıklama çıktısını (debug output) uygular. " +"Bu, bahsi geçen kodda hata ayıklama çıktısını kullanmamız gerektiği anlamına " +"gelir." #: src/tuples-and-arrays/arrays.md msgid "" @@ -4391,14 +4794,6 @@ msgstr "" "`#` eklemek, örneğin `{a:#?}`, okunması daha kolay olabilecek \"güzel " "yazdırma (pretty printing)\" biçimini (format) çağırır." -#: src/tuples-and-arrays/arrays.md -msgid "" -"Arrays are not heap-allocated. They are regular values with a fixed size " -"known at compile time, meaning they go on the stack. This can be different " -"from what students expect if they come from a garbage collected language, " -"where arrays may be heap allocated by default." -msgstr "" - #: src/tuples-and-arrays/tuples.md msgid "Like arrays, tuples have a fixed length." msgstr "Diziler gibi, demetlerin (tuple) de sabit bir uzunluğu vardır." @@ -4426,8 +4821,28 @@ msgstr "" "dillerdeki `void`'e benzer şekilde, bir geri dönüş değerinin (return value) " "bulunmadığını belirtir." -#: src/tuples-and-arrays/iteration.md -msgid "The `for` statement supports iterating over arrays (but not tuples)." +#: src/tuples-and-arrays/tuples.md +msgid "" +"Unlike arrays, tuples cannot be used in a `for` loop. This is because a " +"`for` loop requires all the elements to have the same type, which may not be " +"the case for a tuple." +msgstr "" +"Dizilerin aksine, demetler (tuple) `for` döngüsünde kullanılamaz. Bunun " +"nedeni, `for` döngüsünün tüm elemanların aynı türde olmasını " +"gerektirmesidir; bu, demet için geçerli olmayabilir." + +#: src/tuples-and-arrays/tuples.md +msgid "" +"There is no way to add or remove elements from a tuple. The number of " +"elements and their types are fixed at compile time and cannot be changed at " +"runtime." +msgstr "" +"Bir demete (tuple) eleman eklemenin veya çıkarmanın bir yolu yoktur. Eleman " +"sayısı ve türleri derleme zamanında (compile time) sabittir ve çalışma " +"zamanında (runtime) değiştirilemez." + +#: src/tuples-and-arrays/iteration.md +msgid "The `for` statement supports iterating over arrays (but not tuples)." msgstr "" "'for' deyimi (statement) diziler üzerinde adımlamayı/dolaşmayı destekler " "(ancak demetler (tuples) üzerinde desteklemez)." @@ -4457,7 +4872,7 @@ msgid "" "tuple into its constituent parts:" msgstr "" "Rust, bir demet (tuple) gibi daha büyük bir değeri, onu oluşturan parçalara " -"çözümlemek (destructure) için desen eşleştirmeyi (pattern matching) " +"ayrıştırmak (destructure) için desen eşleştirmeyi (pattern matching) " "kullanmayı destekler:" #: src/tuples-and-arrays/destructuring.md @@ -4498,7 +4913,7 @@ msgid "" "pattern matching will be discussed in more detail later." msgstr "" "Rust ayrıca koşullu ifadelerde desenlerin (patterns) kullanılmasını " -"destekleyerek eşitlik karşılaştırmasının (comparison) ve çözümlenmenin " +"destekleyerek eşitlik karşılaştırmasının (comparison) ve ayrıştırmasının " "(destructuring) aynı anda gerçekleşmesine olanak tanır. Bu desen eşleştirme " "stili daha sonra daha ayrıntılı olarak tartışılacaktır." @@ -4520,10 +4935,10 @@ msgstr "Bu değişkenin türü nedir?" #: src/tuples-and-arrays/exercise.md msgid "" -"Use an array such as the above to write a function `transpose` which will " -"transpose a matrix (turn rows into columns):" +"Use an array such as the above to write a function `transpose` that " +"transposes a matrix (turns rows into columns):" msgstr "" -"Bir matrisin devrini (transpose) yapacak (satırları sütunlara çevirecek) " +"Bir matrisin devriğini (transpose) yapacak (satırları sütunlara çevirecek) " "`transpose` fonksiyonu yazmak için yukarıdaki gibi bir dizi kullanın:" #: src/tuples-and-arrays/exercise.md @@ -4539,6 +4954,19 @@ msgstr "" msgid "// <-- the comment makes rustfmt add a newline\n" msgstr "// <-- bu yorum, rustfmt'nin yeni satır eklemesini sağlar\n" +#: src/tuples-and-arrays/exercise.md src/tuples-and-arrays/solution.md +msgid "\"Original:\"" +msgstr "\"Orjinali:\"" + +#: src/tuples-and-arrays/exercise.md src/tuples-and-arrays/solution.md +#: src/methods-and-traits/traits/associated-types.md +msgid "\"{:?}\"" +msgstr "\"{:?}\"" + +#: src/tuples-and-arrays/exercise.md src/tuples-and-arrays/solution.md +msgid "\"\\nTransposed:\"" +msgstr "\"\\nDevriği alınmış hâli:\"" + #: src/references.md src/smart-pointers.md src/borrowing.md src/iterators.md #: src/error-handling.md src/concurrency/async-pitfalls.md msgid "This segment should take about 55 minutes. It contains:" @@ -4673,7 +5101,7 @@ msgid "" "Exclusive references, also known as mutable references, allow changing the " "value they refer to. They have type `&mut T`." msgstr "" -"Değiştirilebilir referanslar (mutable reference) olarak da bilinen özel " +"Değiştirilebilir referanslar (mutable reference) olarak da bilinen dışlayan " "(exclusive) referanslar, atıfta bulundukları (refer) değerin " "değiştirilmesine olanak tanır. Aynı zamanda, `&mut T` türüne sahiplerdir." @@ -4685,24 +5113,24 @@ msgid "" "exists. Try making an `&point.0` or changing `point.0` while `x_coord` is " "alive." msgstr "" -"\"Özel (exclusive)\", değere erişmek için yalnızca bu referansın " -"kullanılabileceği anlamına gelir. Aynı anda başka hiçbir referans " -"(paylaşılan veya özel olsun farketmez) mevcut olamaz ve özel referans " -"(exclusive) varken atıfta bulunan değere erişilemez. `x_coord` hayattayken " -"bir `&point.0` oluşturmayı veya `point.0`'ı değiştirmeyi deneyin." +"\"Dışlayan (exclusive)\" kelimesinden kasıt, değere erişmek için yalnızca bu " +"referansın kullanılabileceği, diğerlerinin dışlanacağıdır. Aynı anda başka " +"hiçbir referans (paylaşılan veya dışlayan olsun farketmez) mevcut olamaz ve " +"dışlayan referans (exclusive reference) varken atıfta bulunan değere " +"erişilemez. `x_coord` hayattayken bir `&point.0` oluşturmayı veya " +"`point.0`'ı değiştirmeyi deneyin." #: src/references/exclusive.md msgid "" "Be sure to note the difference between `let mut x_coord: &i32` and `let " -"x_coord: &mut i32`. The first one represents a shared reference which can be " -"bound to different values, while the second represents an exclusive " -"reference to a mutable value." +"x_coord: &mut i32`. The first one is a shared reference that can be bound to " +"different values, while the second is an exclusive reference to a mutable " +"value." msgstr "" "`let mut x_coord: &i32` ve `let x_coord: &mut i32` arasındaki farka dikkat " "ettiğinizden emin olun. Birincisi, farklı değerlere bağlanabilen (bind) " -"paylaşılan bir referansı (shared reference) temsil ederken, ikincisi, " -"değiştirilebilir bir değere (mutable value) özel bir referansı (exclusive " -"reference) temsil eder (represent)." +"paylaşımlı bir referanstır (shared reference), ikincisi, değiştirilebilir " +"bir değere (mutable value) dışlayan bir referanstır (exclusive reference)." #: src/references/slices.md msgid "A slice gives you a view into a larger collection:" @@ -4779,14 +5207,14 @@ msgstr "" #: src/references/slices.md msgid "" -"You can't grow a slice to point to a larger section of the backing buffer. " -"The slice loses information about the underlying buffer and so you can't " -"know how larger the slice can be grown." +"You can't grow a slice to point to a larger section of the backing buffer. A " +"slice does not have information about the length of the underlying buffer " +"and so you can't know how large the slice can be grown." msgstr "" "Bir dilimi (slice), destekleyici arabelleğin (backing buffer) daha büyük bir " -"bölümünü gösterecek şekilde büyütemezsiniz. Dilim, temel arabellek " -"(underlying buffer) hakkında bilgiyi kaybeder ve bu nedenle ne kadar " -"büyütülebileceğini bilemezsiniz." +"bölümüne işaret edecek şekilde büyütemezsiniz. Bir dilim, temel arabelleği " +"(underlying buffer) uzunluğu hakkında bilgi içermez ve bu nedenle dilimin ne " +"kadar büyütülebileceğini bilemezsiniz." #: src/references/slices.md msgid "" @@ -5037,6 +5465,9 @@ msgid "" "magnitude(vector: &[f64]) -> f64`. This makes the function more general, at " "the cost of a runtime length check." msgstr "" +"Burada dilim (slice) referansları almak da mümkündür, örneğin, `fn " +"magnitude(vector: &[f64]) -> f64`. Bu, çalışma zamanı uzunluğu kontrolü " +"pahasına fonksiyonu daha genel hâle getirir." #: src/user-defined-types.md src/std-types.md src/std-traits.md #: src/memory-management.md @@ -5205,6 +5636,9 @@ msgid "" "The newtype pattern is covered extensively in the [\"Idiomatic Rust\" module]" "(../idiomatic/leveraging-the-type-system/newtype-pattern.md)." msgstr "" +"Yeni tür deseni (newtype pattern) [\"Rust’ta Tavsiye Edilen Pratikler " +"(Idiomatic)\" modülünde](../idiomatic/leveraging-the-type-system/newtype-" +"pattern.md) ayrıntılı olarak ele alınmıştır." #: src/user-defined-types/tuple-structs.md msgid "" @@ -5216,16 +5650,20 @@ msgstr "" #: src/user-defined-types/tuple-structs.md msgid "" -"Rust generally doesn’t like inexplicit things, like automatic unwrapping or " -"for instance using booleans as integers." +"Rust generally avoids implicit conversions, like automatic unwrapping or " +"using booleans as integers." msgstr "" "Rust genellikle bir nesnenin değerinin otomatik çözülmesini (automatic " -"unwrapping) veya boole değerlerini tamsayı olarak kullanmak gibi açık " -"olmayan şeylerden hoşlanmaz." +"unwrapping) veya bool değerlerinin tamsayı olarak kullanılması gibi örtük " +"dönüşümlerden (implicit conversions) kaçınır." #: src/user-defined-types/tuple-structs.md -msgid "Operator overloading is discussed on Day 3 (generics)." -msgstr "Operatör yüklemesi 3. günde (genelleştirmeler(generics)) tartışıldı." +msgid "" +"Operator overloading is discussed on Day 2 ([Standard Library Traits](../std-" +"traits.md))." +msgstr "" +"Operatör yüklemesi 2. günde ([Standart Kütüphanedeki Özellikler (Traits)](../" +"std-traits.md)) tartışıldı." #: src/user-defined-types/tuple-structs.md msgid "" @@ -5422,19 +5860,13 @@ msgstr "`const`" #: src/user-defined-types/const.md msgid "" -"Constants are evaluated at compile time and their values are inlined " -"wherever they are used:" +"Constants are evaluated at compile time and their values are [inlined]" +"(https://rust-lang.github.io/rfcs/0246-const-vs-static.html) wherever they " +"are used:" msgstr "" "Sabitler (constants) derleme zamanında (compile-time) değerlendirilir ve " -"değerleri kullanıldıkları her yerde satır içi (inline) olarak belirtilir:" - -#: src/user-defined-types/const.md -msgid "" -"According to the [Rust RFC Book](https://rust-lang.github.io/rfcs/0246-const-" -"vs-static.html) these are inlined upon use." -msgstr "" -"[Rust RFC Book'a](https://rust-lang.github.io/rfcs/0246-const-vs-static." -"html) göre bunlar kullanım sırasında satır içidir (inline)." +"değerleri kullanıldıkları her yerde [satır içi](https://rust-lang.github.io/" +"rfcs/0246-const-vs-static.html) (inline) olarak belirtilir:" #: src/user-defined-types/const.md msgid "" @@ -5616,8 +6048,8 @@ msgid "" "If students ask about `#![allow(dead_code)]` at the top of the exercise, " "it's necessary because the only thing we do with the `Event` type is print " "it out. Due to a nuance of how the compiler checks for dead code this causes " -"it to think that the code is unused. They can ignore it for the purpose of " -"this exercise." +"it to think the code is unused. They can ignore it for the purpose of this " +"exercise." msgstr "" "Eğer öğrenciler alıştırmanın en üstündeki `#![allow(dead_code)]` satırını " "sorarlarsa, bunun nedeni `Event` türüyle yaptığımız tek şeyin onu ekrana " @@ -5699,7 +6131,15 @@ msgstr "" msgid "Closures: function pointers with data." msgstr "Çevreleyiciler (closures): veriyle birlikte fonksiyon göstericileri." -#: src/pattern-matching.md src/lifetimes.md +#: src/welcome-day-2.md src/welcome-day-2-afternoon.md src/welcome-day-4.md +msgid "" +"Including 10 minute breaks, this session should take about 2 hours and 50 " +"minutes. It contains:" +msgstr "" +"Bu oturum 10 dakikalık aralar dahil yaklaşık 2 saat 50 dakika sürmelidir. " +"İçeriği:" + +#: src/pattern-matching.md src/generics.md msgid "This segment should take about 50 minutes. It contains:" msgstr "Bu bölüm yaklaşık 50 dakika sürmelidir. İçeriği:" @@ -5709,8 +6149,8 @@ msgid "" "values. Let's review that and talk about a few other things patterns can " "express:" msgstr "" -"1. günde, desenlerin bileşik değerlerini (compound values) _çözümlemek " -"(destructure)_ için nasıl kullanılabileceğini kısaca görmüştük. Şimdi bunu " +"1. günde, bileşik değere (compound values) _ayrıştırmak (destructure)_ için " +"desenlerin (pattern) nasıl kullanılabileceğini kısaca görmüştük. Şimdi bunu " "gözden geçirelim ve desenlerin ifade edebileceği birkaç diğer şey hakkında " "konuşalım:" @@ -5750,8 +6190,8 @@ msgstr "" #: src/pattern-matching/infallible.md msgid "" -"Variable names are patterns that always match and which bind the matched " -"value into a new variable with that name." +"Variable names are patterns that always match and bind the matched value " +"into a new variable with that name." msgstr "" "Değişken adları her zaman eşleşen ve eşleştikleri değeri bu isimle yeni bir " "değişkene bağlayan (bind) desenlerdir." @@ -5869,8 +6309,8 @@ msgid "`|` as an `or`" msgstr "`|` bir `veya (or)` olarak" #: src/pattern-matching/match.md -msgid "`..` can expand as much as it needs to be" -msgstr "`..` gerektiği kadar genişleyebilir" +msgid "`..` matches any number of items" +msgstr "`..` herhangi sayıda öğeyle eşleşir" #: src/pattern-matching/match.md msgid "`1..=5` represents an inclusive range" @@ -5891,7 +6331,6 @@ msgstr "" "etmek istediğimizde önemli ve gereklidir." #: src/pattern-matching/match.md -#, fuzzy msgid "" "Match guards are different from `if` expressions after the `=>`. An `if` " "expression is evaluated after the match arm is selected. Failing the `if` " @@ -5907,11 +6346,11 @@ msgstr "" #: src/pattern-matching/match.md msgid "\"Uppercase\"" -msgstr "" +msgstr "\"Büyük harf\"" #: src/pattern-matching/match.md msgid "\"Bug: this is never printed\"" -msgstr "" +msgstr "\"Hata (bug): bu asla yazdırılmıyor\"" #: src/pattern-matching/match.md msgid "" @@ -5973,7 +6412,7 @@ msgid "" "it contains the full `Option::Some(123)`. This is rarely used but can be " "useful in more complex patterns." msgstr "" -"Bu örnekte `inner`, çözümleme (destructuring) yoluyla `Option`'dan çektiği " +"Bu örnekte `inner`, ayrıştırma (destructuring) yoluyla `Option`'dan çektiği " "123 değerine sahiptir, `outer` ise tüm `Some(inner)` ifadesini yakalar, bu " "nedenle tam `Option::Some(123)`'ü içerir. Bu nadiren kullanılır ancak daha " "karmaşık desenlerde faydalı olabilir." @@ -5983,10 +6422,10 @@ msgid "Structs" msgstr "Yapılar (Structs)" #: src/pattern-matching/destructuring-structs.md -msgid "Like tuples, Struct can also be destructured by matching:" +msgid "Like tuples, structs can also be destructured by matching:" msgstr "" "Demetler (tuples) gibi, yapılar (structs) da eşleştirme (matching) yoluyla " -"çözümlenebilir (destructured):" +"ayrıştırılabilir. (destructured):" #: src/pattern-matching/destructuring-structs.md msgid "\"y = 2, x = {i:?}\"" @@ -6031,10 +6470,9 @@ msgid "" "references." msgstr "" "Aynı etki `match &mut foo` ile de meydana gelir: yakalanan (captures) " -"değerler özel (exclusive) referanslar haline gelir." +"değerler dışlayan (exclusive) referanslar haline gelir." #: src/pattern-matching/destructuring-structs.md -#, fuzzy msgid "" "The distinction between a capture and a constant expression can be hard to " "spot. Try changing the `2` in the first arm to a variable, and see that it " @@ -6048,7 +6486,7 @@ msgstr "" #: src/pattern-matching/destructuring-enums.md msgid "Like tuples, enums can also be destructured by matching:" msgstr "" -"Demetler (tuples) gibi, enum'lar da eşleştirme yoluyla çözümlenebilir " +"Demetler (tuples) gibi, enum'lar da eşleştirme yoluyla ayrıştırılabilir " "(destructured):" #: src/pattern-matching/destructuring-enums.md @@ -6079,7 +6517,7 @@ msgid "" "arm, `half` is bound to the value inside the `Ok` variant. In the second " "arm, `msg` is bound to the error message." msgstr "" -"Burada `Result` değerini _çözümlemek (destructure)_ için kolları (arm) " +"Burada `Result` değerini _ayrıştırmak (destructure)_ için kolları (arm) " "kullandık. İlk kolda, `half`, `Ok` varyantının içindeki değere bağlanır. " "İkinci kolda, `msg` hata mesajına bağlanır." @@ -6132,7 +6570,7 @@ msgstr "" #: src/pattern-matching/let-control-flow.md msgid "" -"Rust has a few control flow constructs which differ from other languages. " +"Rust has a few control flow constructs that differ from other languages. " "They are used for pattern matching:" msgstr "" "Rust'ın diğer dillerden farklı olan birkaç kontrol akışı yapısı vardır. " @@ -6191,7 +6629,7 @@ msgstr "Bir `else` durumuyla, bu bir ifade (expression) olarak kullanılabilir." #: src/pattern-matching/let-control-flow/while-let.md msgid "" "Like with `if let`, there is a [`while let`](https://doc.rust-lang.org/" -"reference/expressions/loop-expr.html#predicate-pattern-loops) variant which " +"reference/expressions/loop-expr.html#predicate-pattern-loops) variant that " "repeatedly tests a value against a pattern:" msgstr "" "`if let`'te olduğu gibi, bir değeri tekrar tekrar bir desene göre test eden " @@ -6319,7 +6757,7 @@ msgstr "" #: src/pattern-matching/exercise.md msgid "" "A bigger and more complex expression would be `(10 * 9) + ((3 - 4) * 5)`, " -"which evaluate to `85`. We represent this as a much bigger tree:" +"which evaluates to `85`. We represent this as a much bigger tree:" msgstr "" "Daha büyük ve daha karmaşık bir ifade, `85` olarak değerlendirilen `(10 * 9) " "+ ((3 - 4) * 5)` olacaktır. Bunu çok daha büyük bir ağaç olarak temsil " @@ -6391,7 +6829,8 @@ msgstr "// Alıcı (receiver) yok, statik bir metot\n" #: src/methods-and-traits/methods.md msgid "// Exclusive borrowed read-write access to self\n" msgstr "" -"// self'e özel (exclusive) ödünç alınmış (borrowed) okuma-yazma erişimi\n" +"// self'e dışlayacak olan (exclusive) ödünç alınmış (borrowed) okuma-yazma " +"erişimi\n" #: src/methods-and-traits/methods.md msgid "// Shared and read-only borrowed access to self\n" @@ -6409,7 +6848,7 @@ msgstr "\"Tur {idx}: {lap} sn\"" #: src/methods-and-traits/methods.md msgid "// Exclusive ownership of self (covered later)\n" -msgstr "// self'in özel (exclusive) sahipliği (daha sonra ele alınacak)\n" +msgstr "// self'in dışlayan (exclusive) sahipliği (daha sonra ele alınacak)\n" #: src/methods-and-traits/methods.md msgid "\"Race {} is finished, total lap time: {}\"" @@ -6468,7 +6907,7 @@ msgstr "`mut self`: yukarıdakiyle aynı, ancak metot nesneyi değiştirebilir." #: src/methods-and-traits/methods.md msgid "" "No receiver: this becomes a static method on the struct. Typically used to " -"create constructors which are called `new` by convention." +"create constructors that are called `new` by convention." msgstr "" "Alıcı (receiver) yok: bu, yapı (struct) üzerinde statik bir metot haline " "gelir. Genellikle geleneksel olarak `new` olarak adlandırılan yapıcılar " @@ -6673,17 +7112,12 @@ msgstr "" #: src/methods-and-traits/traits/associated-types.md msgid "" -"Associated types are placeholder types which are supplied by the trait " +"Associated types are placeholder types that are supplied by the trait " "implementation." msgstr "" "İlişkili türler (associated types), özellik (trait) gerçekleştirimi " "tarafından sağlanan yer tutucu (placeholder) türlerdir." -#: src/methods-and-traits/traits/associated-types.md -#: src/lifetimes/lifetime-elision.md -msgid "\"{:?}\"" -msgstr "\"{:?}\"" - #: src/methods-and-traits/traits/associated-types.md msgid "" "Associated types are sometimes also called \"output types\". The key " @@ -6743,15 +7177,15 @@ msgstr "" #: src/methods-and-traits/deriving.md msgid "" -"Derivation is usually provided for traits that have a common boilerplate-y " +"Derivation is usually provided for traits that have a common boilerplate " "implementation that is correct for most cases. For example, demonstrate how " "a manual `Clone` impl can be repetitive compared to deriving the trait:" msgstr "" "Türetme (derivation) genellikle, çoğu durum için doğru olan yaygın bir " -"basmakalıpsal (boilerplate-y) gerçekleştirmeye sahip özellikler (traits) " -"için sağlanır. Örneğin, bir manuel `Clone` gerçekleştiriminin (impl) " -"özelliği (trait) türetmeye kıyasla nasıl tekrarlanabilen bir yapıda " -"olabileceğini gösterin:" +"basmakalıpsal (boilerplate) gerçekleştirmeye sahip özellikler (traits) için " +"sağlanır. Örneğin, bir manuel `Clone` gerçekleştiriminin (impl) özelliği " +"(trait) türetmeye kıyasla nasıl tekrarlanabilen bir yapıda olabileceğini " +"gösterin:" #: src/methods-and-traits/deriving.md msgid "" @@ -6771,9 +7205,9 @@ msgstr "Alıştırma: Kaydedici Özelliği (Logger Trait)" #: src/methods-and-traits/exercise.md msgid "" "Let's design a simple logging utility, using a trait `Logger` with a `log` " -"method. Code which might log its progress can then take an `&impl Logger`. " -"In testing, this might put messages in the test logfile, while in a " -"production build it would send messages to a log server." +"method. Code that might log its progress can then take an `&impl Logger`. In " +"testing, this might put messages in the test logfile, while in a production " +"build it would send messages to a log server." msgstr "" "Bir `log` metoduna sahip bir `Logger` özelliği (trait) kullanarak basit bir " "kayıt (logging) aracı tasarlayalım. İlerlemesini kaydedebilecek kod daha " @@ -6792,7 +7226,6 @@ msgstr "" "üzerindeki mesajları yoksayacak bir `VerbosityFilter` türü yazmaktır." #: src/methods-and-traits/exercise.md -#, fuzzy msgid "" "This is a common pattern: a struct wrapping a trait implementation and " "implementing that same trait, adding behavior in the process. In the " @@ -7001,7 +7434,7 @@ msgstr "" #: src/generics/generic-data.md msgid "" -"_Q:_ Why `L` is specified twice in `impl .. VerbosityFilter`? " +"_Q:_ Why is `L` specified twice in `impl .. VerbosityFilter`? " "Isn't that redundant?" msgstr "" "_S:_ Neden `L`, `impl .. VerbosityFilter`'de iki kez " @@ -7130,8 +7563,8 @@ msgstr "" #: src/generics/impl-trait.md msgid "" -"`impl Trait` allows you to work with types which you cannot name. The " -"meaning of `impl Trait` is a bit different in the different positions." +"`impl Trait` allows you to work with types that you cannot name. The meaning " +"of `impl Trait` is a bit different in the different positions." msgstr "" "`impl Trait`, isimlendiremeyeceğiniz türlerle çalışmanıza olanak tanır. " "`impl Trait`'in anlamı farklı konumlarda biraz farklıdır." @@ -7216,7 +7649,7 @@ msgid "" "specialized instance of the function for each different type that the " "generic is instantiated with. This means that calling a trait method from " "within a generic function still uses static dispatch, as the compiler has " -"full type information and can resolve which type's trait implementation to " +"full type information and can resolve that type's trait implementation to " "use." msgstr "" "`impl Trait` de dahil olmak üzere genelleştirmeler (generics), " @@ -7334,14 +7767,6 @@ msgstr "" "özelliğini (trait) ve [`Ordering`](https://doc.rust-lang.org/stable/std/cmp/" "enum.Ordering.html) enum'ını gösterin." -#: src/welcome-day-2-afternoon.md src/welcome-day-4.md -msgid "" -"Including 10 minute breaks, this session should take about 2 hours and 50 " -"minutes. It contains:" -msgstr "" -"Bu oturum 10 dakikalık aralar dahil yaklaşık 2 saat 50 dakika sürmelidir. " -"İçeriği:" - #: src/closures.md src/concurrency/threads.md src/concurrency/shared-state.md msgid "This segment should take about 30 minutes. It contains:" msgstr "Bu bölüm yaklaşık 30 dakika sürmelidir. İçeriği:" @@ -7470,9 +7895,9 @@ msgid "" msgstr "" "Varsayılan olarak, çevreleyiciler (closures) dış kapsamdan (outer scope) her " "değişkeni, yapabildikleri en az talepkar erişim biçimiyle yakalarlar " -"(mümkünse paylaşılan (shared) referansla, sonra özel (exclusive) referansla, " -"sonra taşıma (move) ile). `move` anahtar kelimesi, değerle yakalamayı " -"(move)zorlar." +"(mümkünse paylaşılan (shared) referansla, sonra dışlayan (exclusive) " +"referansla, sonra taşıma (move) ile). `move` anahtar kelimesi, değerle " +"yakalamayı (move)zorlar." #: src/closures/traits.md msgid "Closure traits" @@ -7480,7 +7905,7 @@ msgstr "Çevreleyici özellikleri (Closure traits)" #: src/closures/traits.md msgid "" -"Closures or lambda expressions have types which cannot be named. However, " +"Closures or lambda expressions have types that cannot be named. However, " "they implement special [`Fn`](https://doc.rust-lang.org/std/ops/trait.Fn." "html), [`FnMut`](https://doc.rust-lang.org/std/ops/trait.FnMut.html), and " "[`FnOnce`](https://doc.rust-lang.org/std/ops/trait.FnOnce.html) traits:" @@ -7521,7 +7946,6 @@ msgid "\"senior\"" msgstr "\"son sınıf\"" #: src/closures/traits.md -#, fuzzy msgid "\"appendix\"" msgstr "\"apandis\"" @@ -7572,9 +7996,9 @@ msgid "" "but not concurrently." msgstr "" "Bir `FnMut` (ör. `accumulate`) yakalanan değerleri (captured values) " -"değiştirebilir. Çevreleyici (closure) nesnesine özel (exclusive) referans " -"yoluyla erişilir, bu nedenle tekrar tekrar çağrılabilir ancak eş zamanlı " -"olarak (concurrently) çağrılamaz." +"değiştirebilir. Çevreleyici (closure) nesnesine dışlayan (exclusive) " +"referans yoluyla erişilir, bu nedenle tekrar tekrar çağrılabilir ancak eş " +"zamanlı olarak (concurrently) çağrılamaz." #: src/closures/traits.md msgid "" @@ -7609,11 +8033,11 @@ msgstr "" #: src/closures/traits.md msgid "" "In contrast, when you have a closure, the most flexible you can have is `Fn` " -"(which can be passed to a consumer of any of the 3 closure traits), then " +"(which can be passed to a consumer of any of the three closure traits), then " "`FnMut`, and lastly `FnOnce`." msgstr "" "Buna karşılık, bir çevreleyiciniz (closure) olduğunda, sahip olabileceğiniz " -"en esnek olan `Fn`'dir (3 çevreleyici özelliğinin (trait) herhangi birinin " +"en esnek olan `Fn`'dir (üç çevreleyici özelliğinin (trait) herhangi birinin " "tüketicisine geçirilebilir), sonra `FnMut` ve son olarak `FnOnce`." #: src/closures/traits.md @@ -7629,9 +8053,9 @@ msgstr "" #: src/closures/exercise.md msgid "" -"Building on the generic logger from this morning, implement a `Filter` which " -"uses a closure to filter log messages, sending those which pass the " -"filtering predicate to an inner logger." +"Building on the generic logger from this morning, implement a `Filter` that " +"uses a closure to filter log messages, sending those that pass the filtering " +"predicate to an inner logger." msgstr "" "Bu sabahki genel kaydediciden (logger) yola çıkarak, kayıt mesajlarını " "filtrelemek için bir çevreleyici (closure) kullanan bir `Filter` " @@ -7703,7 +8127,7 @@ msgstr "" #: src/std-types/std.md msgid "" -"Rust comes with a standard library which helps establish a set of common " +"Rust comes with a standard library that helps establish a set of common " "types used by Rust libraries and programs. This way, two libraries can work " "together smoothly because they both use the same `String` type." msgstr "" @@ -7730,7 +8154,7 @@ msgstr "" #: src/std-types/std.md msgid "" -"`alloc` includes types which require a global heap allocator, such as `Vec`, " +"`alloc` includes types that require a global heap allocator, such as `Vec`, " "`Box` and `Arc`." msgstr "" "`alloc`, `Vec`, `Box` ve `Arc` gibi global bir dinamik bellek tahsis " @@ -8289,8 +8713,8 @@ msgstr "" #: src/std-types/hashmap.md msgid "" -"Alternatively HashMap can be built from any `Iterator` which yields key-" -"value tuples." +"Alternatively HashMap can be built from any `Iterator` that yields key-value " +"tuples." msgstr "" "Alternatif olarak HashMap, anahtar-değer (key-value) demetleri (tuple) " "üreten herhangi bir `Iterator`'dan oluşturulabilir." @@ -8311,7 +8735,7 @@ msgstr "" msgid "" "In this exercise you will take a very simple data structure and make it " "generic. It uses a [`std::collections::HashMap`](https://doc.rust-lang.org/" -"stable/std/collections/struct.HashMap.html) to keep track of which values " +"stable/std/collections/struct.HashMap.html) to keep track of what values " "have been seen and how many times each one has appeared." msgstr "" "Bu alıştırmada çok basit bir veri yapısı alıp onu genelleştirilmiş (generic) " @@ -8321,11 +8745,11 @@ msgstr "" #: src/std-types/exercise.md msgid "" -"The initial version of `Counter` is hard coded to only work for `u32` " -"values. Make the struct and its methods generic over the type of value being " +"The initial version of `Counter` is hardcoded to only work for `u32` values. " +"Make the struct and its methods generic over the type of value being " "tracked, that way `Counter` can track any type of value." msgstr "" -"`Counter`'ın ilk sürümü sadece `u32` değerleri için çalışacak şekilde sabit " +"`Counter`'ın ilk versiyonu sadece `u32` değerleri için çalışacak şekilde " "kodlanmıştır. Yapıyı ve metotlarını, izlenen değerin türü üzerinde " "genelleştirme (generic) yapın, bu şekilde `Counter` her tür değeri " "izleyebilir." @@ -8388,7 +8812,7 @@ msgstr "Default, yapı güncelleme sözdizimi (struct update syntax)" #: src/std-traits.md msgid "" -"As with the standard-library types, spend time reviewing the documentation " +"As with the standard library types, spend time reviewing the documentation " "for each trait." msgstr "" "Standart kütüphane türlerinde olduğu gibi, her bir özellik (trait) için de " @@ -8536,15 +8960,15 @@ msgstr "" #: src/std-traits/operators.md msgid "" -"The `Not` trait (`!` operator) is notable because it does not \"boolify\" " -"like the same operator in C-family languages; instead, for integer types it " -"negates each bit of the number, which arithmetically is equivalent to " -"subtracting it from -1: `!5 == -6`." +"The `Not` trait (`!` operator) is notable because it does not convert the " +"argument to `bool` like the same operator in C-family languages; instead, " +"for integer types it flips each bit of the number, which, arithmetically, is " +"equivalent to subtracting the argument from `-1`: `!5 == -6`." msgstr "" -"`Not` özelliği (`!` operatörü), C ailesi dillerindeki aynı operatör gibi " -"\"boole'laştırmadığı\" için dikkat çekicidir; bunun yerine, tamsayı türleri " -"için sayının her bitini olumsuzlar, bu da aritmetik olarak onu -1'den " -"çıkarmaya eşdeğerdir: `!5 == -6`." +"`Not` özelliği (`!` operatörü) dikkat çekicidir çünkü C dillerindeki aynı " +"operatör gibi argümanı `bool`'a dönüştürmez; bunun yerine, tam sayı türleri " +"için sayının her bitini tersine çevirir; bu da aritmetik olarak argümanı " +"`-1`'den çıkarmaya eşdeğerdir: `!5 == -6`." #: src/std-traits/from-and-into.md msgid "" @@ -8819,21 +9243,24 @@ msgstr "" #: src/welcome-day-3.md msgid "Welcome to Day 3" -msgstr "" +msgstr "3. Gün'e Hoş Geldiniz" #: src/welcome-day-3.md msgid "Today, we will cover:" -msgstr "" +msgstr "Bugün, şunları ele alacağız:" #: src/welcome-day-3.md msgid "" "Memory management, lifetimes, and the borrow checker: how Rust ensures " "memory safety." msgstr "" +"Bellek yönetimi, ömürler (lifetimes) ve ödünç alma denetleyicisi (borrow " +"checker): Rust'ın bellek emniyetini (memory safety) nasıl sağladığı." #: src/welcome-day-3.md msgid "Smart pointers: standard library pointer types." msgstr "" +"Akıllı göstericiler (Smart pointers): standart kütüphane gösterici türleri." #: src/welcome-day-3.md src/welcome-day-4-afternoon.md msgid "" @@ -8845,7 +9272,7 @@ msgstr "" #: src/memory-management.md src/memory-management/clone.md msgid "Clone" -msgstr "" +msgstr "Clone" #: src/memory-management.md msgid "Drop" @@ -8853,55 +9280,71 @@ msgstr "Drop" #: src/memory-management/review.md msgid "Programs allocate memory in two ways:" -msgstr "" +msgstr "Programlar iki şekilde bellek tahsis eder (allocate):" #: src/memory-management/review.md msgid "Stack: Continuous area of memory for local variables." -msgstr "" +msgstr "Yığın (Stack): Yerel değişkenler için sürekli olan bir bellek alanı." #: src/memory-management/review.md msgid "Values have fixed sizes known at compile time." msgstr "" +"Değerlerin derleme zamanında (compile time) bilinen sabit boyutları (fixed " +"size) vardır." #: src/memory-management/review.md msgid "Extremely fast: just move a stack pointer." msgstr "" +"Son derece hızlı: sadece bir yığın göstericisi (stack pointer) yeni bir " +"değer alır." #: src/memory-management/review.md msgid "Easy to manage: follows function calls." msgstr "" +"Yönetimi kolay: fonksiyon çağrılarını izler (fonksiyon nereden çağrıldı " +"bilgisinin kaydı)." #: src/memory-management/review.md msgid "Great memory locality." msgstr "" +"Mükemmel bellek yerelliği (memory locality) sağlar (önbellek durumları için)." #: src/memory-management/review.md msgid "Heap: Storage of values outside of function calls." msgstr "" +"Dinamik Bellek (Heap): Fonksiyon çağrıları dışındaki değerlerin depolanması." #: src/memory-management/review.md msgid "Values have dynamic sizes determined at runtime." -msgstr "" +msgstr "Bazı değerlerin çalışma zamanında belirlenen dinamik boyutları vardır." #: src/memory-management/review.md -msgid "Slightly slower than the stack: some book-keeping needed." +msgid "Slightly slower than the stack: some bookkeeping needed." msgstr "" +"Yığından (stack) biraz daha yavaş: bazı yönetim işlemleri (bookkeeping) " +"gerekir." #: src/memory-management/review.md msgid "No guarantee of memory locality." -msgstr "" +msgstr "Bellek yerelliği garantisi yoktur." #: src/memory-management/review.md msgid "" "Creating a `String` puts fixed-sized metadata on the stack and dynamically " "sized data, the actual string, on the heap:" msgstr "" +"Bir `String` oluşturmak, yığına (stack) sabit boyutlu üst veri (metadata) ve " +"dinamik belleğe (heap) ise gerçek dizeyi (string) tutan dinamik boyutlu " +"verileri koyar:" #: src/memory-management/review.md msgid "" "Mention that a `String` is backed by a `Vec`, so it has a capacity and " "length and can grow if mutable via reallocation on the heap." msgstr "" +"Bir `String`'in aslında bir `Vec` kullandığını, bu nedenle bir kapasitesi ve " +"uzunluğu olduğunu ve değiştirilebilir (mutable) ise dinamik bellekte (heap) " +"yeniden tahsis (reallocation) yoluyla büyüyebileceğini belirtin." #: src/memory-management/review.md msgid "" @@ -8910,16 +9353,24 @@ msgid "" "struct.System.html) and custom allocators can be implemented using the " "[Allocator API](https://doc.rust-lang.org/std/alloc/index.html)" msgstr "" +"Öğrenciler sorarsa, temel belleğin (underlying memory) [Sistem Tahsis " +"Edicisi (System Allocator)](https://doc.rust-lang.org/std/alloc/struct." +"System.html) kullanılarak dinamik bellekten (heap) tahsis edildiğini ve özel " +"bellek tahsis edicilerin (custom allocators) [Tahsis Edici API'si (Allocator " +"API)](https://doc.rust-lang.org/std/alloc/index.html) kullanılarak " +"gerçekleştirilebileceğini belirtebilirsiniz." #: src/memory-management/review.md msgid "" "We can inspect the memory layout with `unsafe` Rust. However, you should " "point out that this is rightfully unsafe!" msgstr "" +"Bellek düzenini (memory layout) `unsafe` Rust ile inceleyebiliriz. Ancak, " +"bunun haklı olarak emniyetsiz (unsafe) olduğuna dikkat etmelisiniz!" #: src/memory-management/review.md src/testing/unit-tests.md msgid "' '" -msgstr "" +msgstr "' '" #: src/memory-management/review.md msgid "\"world\"" @@ -8932,67 +9383,84 @@ msgid "" "to\n" " // undefined behavior.\n" msgstr "" +"// BUNU EVDE DENEMEYİN! Sadece eğitim amaçlıdır.\n" +" // String, düzeni hakkında hiçbir garanti vermez, bu nedenle bu\n" +" // tanımsız davranışa (undefined behavior) yol açabilir.\n" #: src/memory-management/review.md msgid "\"capacity = {capacity}, ptr = {ptr:#x}, len = {len}\"" -msgstr "" +msgstr "\"kapasite = {capacity}, ptr = {ptr:#x}, uzunluk = {len}\"" #: src/memory-management/approaches.md msgid "Traditionally, languages have fallen into two broad categories:" -msgstr "" +msgstr "Geleneksel olarak, diller iki geniş kategoriye ayrılmıştır:" #: src/memory-management/approaches.md msgid "Full control via manual memory management: C, C++, Pascal, ..." -msgstr "" +msgstr "Manuel bellek yönetimi ile tam kontrol: C, C++, Pascal, ..." #: src/memory-management/approaches.md msgid "Programmer decides when to allocate or free heap memory." msgstr "" +"Programcı, dinamik bellek (heap) tahsis etme (allocate) veya serbest bırakma " +"(free) zamanına karar verir." #: src/memory-management/approaches.md msgid "" "Programmer must determine whether a pointer still points to valid memory." msgstr "" +"Programcı, bir göstericinin (pointer) hala geçerli belleği gösterip " +"göstermediğini belirlemelidir." #: src/memory-management/approaches.md msgid "Studies show, programmers make mistakes." -msgstr "" +msgstr "Araştırmalar, programcıların hata yaptığını gösteriyor." #: src/memory-management/approaches.md msgid "" "Full safety via automatic memory management at runtime: Java, Python, Go, " "Haskell, ..." msgstr "" +"Çalışma zamanında (runtime) otomatik bellek yönetimi ile tam emniyet " +"(safety): Java, Python, Go, Haskell, ..." #: src/memory-management/approaches.md msgid "" "A runtime system ensures that memory is not freed until it can no longer be " "referenced." msgstr "" +"Bir çalışma zamanı sistemi (runtime system), belleğin artık referans " +"alınamayana kadar serbest bırakılmamasını sağlar." #: src/memory-management/approaches.md msgid "Typically implemented with reference counting or garbage collection." -msgstr "Genellikle referans sayımı veya çöp toplama ile uygulanır." +msgstr "" +"Genellikle referans sayımı (reference counting) veya çöp toplama (garbage " +"collection) ile gerçekleştirilir." #: src/memory-management/approaches.md msgid "Rust offers a new mix:" -msgstr "" +msgstr "Rust yeni bir karışım sunar:" #: src/memory-management/approaches.md msgid "" "Full control _and_ safety via compile time enforcement of correct memory " "management." msgstr "" +"Derleme zamanında (compile time) doğru bellek yönetiminin zorunlu kılınması " +"yoluyla tam kontrol _ve_ emniyet (safety)." #: src/memory-management/approaches.md msgid "It does this with an explicit ownership concept." -msgstr "" +msgstr "Bunu, açık sahiplik (explicit ownership) kavramıyla yapar." #: src/memory-management/approaches.md msgid "" "This slide is intended to help students coming from other languages to put " "Rust in context." msgstr "" +"Bu slaytın amacı, farklı programlama dillerinden gelen öğrencilerin Rust’ın " +"nerede durduğunu kavramalarına yardımcı olmaktır." #: src/memory-management/approaches.md msgid "" @@ -9000,14 +9468,24 @@ msgid "" "forgetting to call `free`, calling it multiple times for the same pointer, " "or dereferencing a pointer after the memory it points to has been freed." msgstr "" +"C, dinamik belleği (heap) manuel olarak `malloc` ve `free` ile yönetir. " +"Yaygın hatalar arasında `free` çağırmayı unutmak, aynı gösterici için birden " +"çok kez `free` fonksiyonunu çağırmak veya gösterdiği bellek serbest " +"bırakıldıktan (free) sonra bir göstericinin içeriğine erişmek " +"(dereferencing) yer alır." #: src/memory-management/approaches.md msgid "" "C++ has tools like smart pointers (`unique_ptr`, `shared_ptr`) that take " "advantage of language guarantees about calling destructors to ensure memory " -"is freed when a function returns. It is still quite easy to mis-use these " +"is freed when a function returns. It is still quite easy to misuse these " "tools and create similar bugs to C." msgstr "" +"C++, bir fonksiyon geri döndüğünde tahsis edilen belleğin serbest " +"bırakılmasını sağlamak için yıkıcı özel üye fonksiyonlarını (destructors) " +"çağırma konusundaki dil garantilerinden yararlanan akıllı göstericiler " +"(`unique_ptr`, `shared_ptr`) gibi araçlara sahiptir. Bu araçları yanlış " +"kullanmak ve C'ye benzer hatalar oluşturmak hala oldukça kolaydır." #: src/memory-management/approaches.md msgid "" @@ -9016,45 +9494,72 @@ msgid "" "be dereferenced, eliminating use-after-free and other classes of bugs. But, " "GC has a runtime cost and is difficult to tune properly." msgstr "" +"Java, Go ve Python, artık erişilemeyen belleği belirlemek ve atmak için çöp " +"toplayıcıya (garbage collector) güvenir. Bu, herhangi bir göstericinin " +"içeriğine erişilebileceğini (dereferenced) garanti eder, serbest bırakma " +"sonrası kullanım (use-after-free) ve diğer hata sınıflarını ortadan " +"kaldırır. Ancak, ÇT'nin (GC) bir çalışma zamanı (runtime cost) maliyeti " +"vardır ve doğru bir şekilde ayarlamak zordur." #: src/memory-management/approaches.md msgid "" "Rust's ownership and borrowing model can, in many cases, get the performance " "of C, with alloc and free operations precisely where they are required -- " -"zero cost. It also provides tools similar to C++'s smart pointers. When " +"zero-cost. It also provides tools similar to C++'s smart pointers. When " "required, other options such as reference counting are available, and there " "are even crates available to support runtime garbage collection (not covered " "in this class)." msgstr "" +"Rust'ın sahiplik (ownership) ve ödünç alma (borrowing) modeli, birçok " +"durumda, C'nin performansını, tam olarak gerekli oldukları yerde -sıfır " +"maliyetle (zero cost)- tahsis (alloc) ve serbest bırakma (free) işlemleriyle " +"elde edebilir. Ayrıca C++'nın akıllı göstericilerine (smart pointers) benzer " +"araçlar da sağlar. Gerektiğinde, referans sayımı (reference counting) gibi " +"diğer seçenekler de mevcuttur ve hatta çalışma zamanı çöp toplamayı (runtime " +"garbage collection) desteklemek için mevcut olan kasalar (crates) bile " +"vardır (bu derste ele alınmamaktadır)." #: src/memory-management/ownership.md msgid "" "All variable bindings have a _scope_ where they are valid and it is an error " "to use a variable outside its scope:" msgstr "" +"Tüm değişken bağlamalarının (variable bindings) geçerli oldukları bir " +"_kapsamı (scope)_ vardır ve bir değişkeni kapsamı dışında kullanmak bir " +"hatadır:" #: src/memory-management/ownership.md msgid "" "We say that the variable _owns_ the value. Every Rust value has precisely " "one owner at all times." msgstr "" +"Değişkenin değeri _sahiplendiğini_ söyleriz. Her Rust değerinin her zaman " +"tam olarak \"bir\" sahibi vardır." #: src/memory-management/ownership.md msgid "" "At the end of the scope, the variable is _dropped_ and the data is freed. A " "destructor can run here to free up resources." msgstr "" +"Kapsamın (scope) sonunda, değişken _düşürülür (dropped)_ ve veriler serbest " +"bırakılır (free). Kaynakları serbest bırakmak için burada bir yıkıcı " +"(destructor) çalışabilir." #: src/memory-management/ownership.md msgid "" -"Students familiar with garbage-collection implementations will know that a " +"Students familiar with garbage collection implementations will know that a " "garbage collector starts with a set of \"roots\" to find all reachable " "memory. Rust's \"single owner\" principle is a similar idea." msgstr "" +"Çöp toplama (garbage collection) gerçekleştirmelerine (implementations) " +"aşina olan öğrenciler, bir çöp toplayıcının tüm erişilebilir belleği " +"(reachable memory) bulmak için bir dizi \"kök (roots)\" ile başladığını " +"bilirler. Rust'ın \"tek sahip (single owner)\" ilkesi benzer bir fikirdir." #: src/memory-management/move.md msgid "An assignment will transfer _ownership_ between variables:" msgstr "" +"Bir atama (assignment), değişkenler arasında _sahipliği (ownership)_ aktarır:" #: src/memory-management/move.md src/concurrency/async-control-flow/select.md msgid "\"Hello!\"" @@ -9062,27 +9567,31 @@ msgstr "\"Merhaba!\"" #: src/memory-management/move.md msgid "// dbg!(s1);\n" -msgstr "" +msgstr "// dbg!(s1);\n" #: src/memory-management/move.md msgid "The assignment of `s1` to `s2` transfers ownership." -msgstr "" +msgstr "`s1`'in `s2`'ye atanması sahipliği (ownership) aktarır." #: src/memory-management/move.md msgid "When `s1` goes out of scope, nothing happens: it does not own anything." msgstr "" +"`s1` kapsam (scope) dışına çıktığında hiçbir şey olmaz: hiçbir şeye sahip " +"değildir." #: src/memory-management/move.md msgid "When `s2` goes out of scope, the string data is freed." msgstr "" +"`s2` kapsam (scope) dışına çıktığında, dize (string) verisi serbest " +"bırakılır." #: src/memory-management/move.md msgid "Before move to `s2`:" -msgstr "" +msgstr "`s2`'ye taşımadan (move) önce:" #: src/memory-management/move.md msgid "After move to `s2`:" -msgstr "" +msgstr "`s2`'ye taşıdıktan (move) sonra:" #: src/memory-management/move.md msgid "" @@ -9107,12 +9616,42 @@ msgid "" "`- - - - - - - - - - - - - -'\n" "```" msgstr "" +"```bob\n" +" Yığın (Stack) Dinamik Bellek (Heap)\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - " +"- - -.\n" +": : : :\n" +": s1 " +"\"(erişilemez)\" : : :\n" +": +-----------+-------+ : : +----+----+----+----+----+----+----" +"+----+ :\n" +": | ptr | o---+---+--+--+-->| M | e | r | h | a | b | a " +"| ! | :\n" +": | len | 8 | : | : +----+----+----+----+----+----+----" +"+----+ :\n" +": | capacity | 8 | : " +"| : :\n" +": +-----------+-------+ : " +"| : :\n" +": : | `- - - - - - - - - - - - - - - - - - - - - " +"- - -'\n" +": s2 : |\n" +": +-----------+-------+ : |\n" +": | ptr | o---+---+--'\n" +": | len | 8 | :\n" +": | capacity | 8 | :\n" +": +-----------+-------+ :\n" +": :\n" +"`- - - - - - - - - - - - - -'\n" +"```" #: src/memory-management/move.md msgid "" "When you pass a value to a function, the value is assigned to the function " "parameter. This transfers ownership:" msgstr "" +"Bir değeri bir fonksiyona geçirdiğinizde, değer fonksiyon parametresine " +"atanır. Bu, sahipliği (ownership) aktarır:" #: src/memory-management/move.md src/memory-management/clone.md msgid "\"Hello {name}\"" @@ -9120,18 +9659,23 @@ msgstr "\"Merhaba {name}\"" #: src/memory-management/move.md src/memory-management/clone.md #: src/android/aidl/types/parcelables.md src/android/interoperability/java.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md msgid "\"Alice\"" -msgstr "\"Alice\"" +msgstr "\"Ayşe\"" #: src/memory-management/move.md msgid "// say_hello(name);\n" -msgstr "" +msgstr "// say_hello(name);\n" #: src/memory-management/move.md msgid "" "Mention that this is the opposite of the defaults in C++, which copies by " "value unless you use `std::move` (and the move constructor is defined!)." msgstr "" +"Bunun C++'daki varsayılanların tersi olduğunu belirtin; C++ `std::move` " +"kullanmadığınız sürece (ve taşıyan yapıcı özel üye fonksiyonu (move " +"constructor) tanımlanmışsa!) değere göre kopyalama yapar." #: src/memory-management/move.md msgid "" @@ -9139,82 +9683,102 @@ msgid "" "to manipulate the data itself is a matter of optimization, and such copies " "are aggressively optimized away." msgstr "" +"Sadece sahiplik (ownership) taşınır. Verinin kendisini işlemek için herhangi " +"bir makine kodunun üretilip üretilmediği bir optimizasyon meselesidir ve bu " +"tür kopyalamalar agresif bir şekilde optimize edilerek kaldırılır." #: src/memory-management/move.md msgid "" "Simple values (such as integers) can be marked `Copy` (see later slides)." msgstr "" +"Basit değerler (tamsayılar gibi) `Copy` olarak işaretlenebilir (sonraki " +"slaytları inceleyin)." #: src/memory-management/move.md msgid "In Rust, clones are explicit (by using `clone`)." -msgstr "" +msgstr "Rust'ta, klonlamalar (clones) açıktır (`clone` kullanarak)." #: src/memory-management/move.md msgid "In the `say_hello` example:" -msgstr "" +msgstr "`say_hello` örneğinde:" #: src/memory-management/move.md msgid "" "With the first call to `say_hello`, `main` gives up ownership of `name`. " "Afterwards, `name` cannot be used anymore within `main`." msgstr "" +"`say_hello`'ya yapılan ilk çağrıyla, `main` `name`'in sahipliğinden " +"(ownership) vazgeçer. Daha sonra, `name` artık `main` içinde kullanılamaz." #: src/memory-management/move.md msgid "" "The heap memory allocated for `name` will be freed at the end of the " "`say_hello` function." msgstr "" +"`name` için tahsis edilen dinamik bellek (heap), `say_hello` fonksiyonunun " +"sonunda serbest bırakılacaktır." #: src/memory-management/move.md msgid "" "`main` can retain ownership if it passes `name` as a reference (`&name`) and " "if `say_hello` accepts a reference as a parameter." msgstr "" +"`main`, `name`'i referans olarak (`&name`) geçirirse ve `say_hello` " +"parametresinde bir referans kabul ederse sahipliği elinde tutabilir." #: src/memory-management/move.md msgid "" "Alternatively, `main` can pass a clone of `name` in the first call (`name." "clone()`)." msgstr "" +"Alternatif olarak, `main` ilk çağrıda `name`'in bir klonunu (`name." +"clone()`)geçirebilir." #: src/memory-management/move.md msgid "" "Rust makes it harder than C++ to inadvertently create copies by making move " "semantics the default, and by forcing programmers to make clones explicit." msgstr "" +"Rust, taşıma (move) semantiğini varsayılan yaparak ve programcıları " +"klonlamaları açık hale getirmeye zorlayarak, C++'a göre istemeden kopya " +"oluşturmayı daha zor hale getirir." #: src/memory-management/move.md msgid "Defensive Copies in Modern C++" -msgstr "" +msgstr "Modern C++'da Savunmacı Kopyalar" #: src/memory-management/move.md msgid "Modern C++ solves this differently:" -msgstr "" +msgstr "Modern C++ bunu farklı şekilde çözer:" #: src/memory-management/move.md msgid "\"Cpp\"" -msgstr "" +msgstr "\"Cpp\"" #: src/memory-management/move.md msgid "// Duplicate the data in s1.\n" -msgstr "" +msgstr "// s1'deki veriyi çoğalt.\n" #: src/memory-management/move.md msgid "" "The heap data from `s1` is duplicated and `s2` gets its own independent copy." msgstr "" +"`s1`'den gelen dinamik bellek (heap) verisi kopyalanır ve `s2` kendi " +"bağımsız kopyasını alır." #: src/memory-management/move.md msgid "When `s1` and `s2` go out of scope, they each free their own memory." msgstr "" +"`s1` ve `s2` kapsam (scope) dışına çıktığında, her biri kendi belleğini " +"serbest bırakır." #: src/memory-management/move.md msgid "Before copy-assignment:" -msgstr "" +msgstr "Kopyalayan atama'dan (copy-assignment) önce:" #: src/memory-management/move.md msgid "After copy-assignment:" -msgstr "" +msgstr "Kopyalayan atamadan (copy-assignment) sonra:" #: src/memory-management/move.md msgid "" @@ -9222,6 +9786,10 @@ msgid "" "the string data has to be cloned. Otherwise we would get a double-free when " "either string goes out of scope." msgstr "" +"C++, Rust'tan biraz farklı bir seçim yapmıştır. `=` veriyi kopyaladığı için, " +"dize (string) verisinin klonlanması gerekir. Aksi takdirde, herhangi bir " +"dize kapsam dışına çıktığında çifte serbest bırakma (double-free) hatası " +"alırdık." #: src/memory-management/move.md msgid "" @@ -9231,108 +9799,142 @@ msgid "" "move, `s1` would be in a valid but unspecified state. Unlike Rust, the " "programmer is allowed to keep using `s1`." msgstr "" +"C++ ayrıca bir değerin ne zaman taşınabileceğini belirtmek için kullanılan " +"[`std::move`](https://en.cppreference.com/w/cpp/utility/move)'a sahiptir. " +"Eğer örnek `s2 = std::move(s1)` olsaydı, hiçbir dinamik bellek (heap) " +"tahsisi gerçekleşmezdi. Taşıma işleminden sonra, `s1` geçerli ancak belirsiz " +"bir durumda olurdu. Rust'tan farklı olarak, programcının `s1`'i kullanmaya " +"devam etmesine izin verilir." #: src/memory-management/move.md msgid "" "Unlike Rust, `=` in C++ can run arbitrary code as determined by the type " -"which is being copied or moved." +"that is being copied or moved." msgstr "" +"Rust'tan farklı olarak, C++'daki `=` kopyalanan veya taşınan türe göre " +"belirlenen keyfi kodları çalıştırabilir." #: src/memory-management/clone.md msgid "" "Sometimes you _want_ to make a copy of a value. The `Clone` trait " "accomplishes this." msgstr "" +"Bazen bir değerin bir kopyasını oluşturmak _istersiniz_. `Clone` özelliği " +"(trait) bunu gerçekleştirir." #: src/memory-management/clone.md msgid "" "The idea of `Clone` is to make it easy to spot where heap allocations are " "occurring. Look for `.clone()` and a few others like `vec!` or `Box::new`." msgstr "" +"`Clone` fikri, dinamik bellek (heap) tahsislerinin nerede meydana geldiğini " +"kolayca tespit etmektir. `.clone()` ve `vec!` veya `Box::new` gibi birkaç " +"diğerine bakın." #: src/memory-management/clone.md msgid "" "It's common to \"clone your way out\" of problems with the borrow checker, " "and return later to try to optimize those clones away." msgstr "" +"Ödünç alma denetleyicisi (borrow checker) ile ilgili sorunlardan " +"\"klonlayarak kurtulmak\" ve daha sonra bu klonları optimize etmeye çalışmak " +"için geri dönmek yaygındır." #: src/memory-management/clone.md msgid "" "`clone` generally performs a deep copy of the value, meaning that if you e." "g. clone an array, all of the elements of the array are cloned as well." msgstr "" +"`clone` genellikle değerin derin bir kopyasını (deep copy) gerçekleştirir, " +"yani örneğin bir diziyi klonlarsanız, dizinin tüm elemanları da klonlanır." #: src/memory-management/clone.md msgid "" "The behavior for `clone` is user-defined, so it can perform custom cloning " "logic if needed." msgstr "" +"`clone`'un davranışı kullanıcı tanımlıdır, bu nedenle gerekirse özel " +"klonlama mantığı gerçekleştirebilir." #: src/memory-management/copy-types.md msgid "" "While move semantics are the default, certain types are copied by default:" msgstr "" +"Taşıma (move) semantiği varsayılan olsa da, belirli türler varsayılan olarak " +"kopyalanır:" #: src/memory-management/copy-types.md msgid "These types implement the `Copy` trait." -msgstr "" +msgstr "Bu türler `Copy` özelliğini (trait) gerçekleştirir." #: src/memory-management/copy-types.md msgid "You can opt-in your own types to use copy semantics:" msgstr "" +"Kendi türlerinizi kopya semantiğini (copy semantics) kullanacak şekilde " +"seçebilirsiniz:" #: src/memory-management/copy-types.md msgid "After the assignment, both `p1` and `p2` own their own data." -msgstr "" +msgstr "Atamadan sonra hem `p1` hem de `p2` kendi verilerine sahiptir." #: src/memory-management/copy-types.md msgid "We can also use `p1.clone()` to explicitly copy the data." -msgstr "" +msgstr "Veriyi açıkça kopyalamak için `p1.clone()` da kullanabiliriz." #: src/memory-management/copy-types.md msgid "Copying and cloning are not the same thing:" -msgstr "" +msgstr "Kopyalama (copying) ve klonlama (cloning) aynı şey değildir:" #: src/memory-management/copy-types.md msgid "" "Copying refers to bitwise copies of memory regions and does not work on " "arbitrary objects." msgstr "" +"Kopyalama, bellek bölgelerinin bitsel kopyalarına atıfta bulunur ve keyfi " +"nesneler üzerinde çalışmaz." #: src/memory-management/copy-types.md msgid "" "Copying does not allow for custom logic (unlike copy constructors in C++)." msgstr "" +"Kopyalama, özel mantığa izin vermez (C++'daki kopyalayan yapıcı özel üye " +"fonksiyonlarının -copy constructors- aksine)." #: src/memory-management/copy-types.md msgid "" "Cloning is a more general operation and also allows for custom behavior by " "implementing the `Clone` trait." msgstr "" +"Klonlama daha genel bir işlemdir ve ayrıca `Clone` özelliğini (trait) " +"gerçekleştirerek özel davranışlara da olanak tanır." #: src/memory-management/copy-types.md msgid "Copying does not work on types that implement the `Drop` trait." -msgstr "" +msgstr "`Drop` özelliğini (trait) gerçekleştiren türlerde kopyalama çalışmaz." #: src/memory-management/copy-types.md msgid "In the above example, try the following:" -msgstr "" +msgstr "Yukarıdaki örnekte, aşağıdakileri deneyin:" #: src/memory-management/copy-types.md msgid "" "Add a `String` field to `struct Point`. It will not compile because `String` " "is not a `Copy` type." msgstr "" +"`struct Point`'e bir `String` alanı ekleyin. `String` bir `Copy` türü " +"olmadığı için derlenmeyecektir." #: src/memory-management/copy-types.md msgid "" "Remove `Copy` from the `derive` attribute. The compiler error is now in the " "`println!` for `p1`." msgstr "" +"`derive` özniteliğinden `Copy`'yi kaldırın. Derleyici hatası şimdi `p1` için " +"`println!`'dedir." #: src/memory-management/copy-types.md msgid "Show that it works if you clone `p1` instead." -msgstr "" +msgstr "Bunun yerine `p1`'i klonlarsanız çalıştığını gösterin." #: src/memory-management/copy-types.md msgid "" @@ -9341,68 +9943,82 @@ msgid "" "valid to make a copy of a shared reference, creating a copy of a mutable " "reference would violate Rust's borrowing rules." msgstr "" +"Paylaşılan (shared) referanslar `Copy`/`Clone`'dur, değiştirilebilir " +"(mutable) referanslar değildir. Bunun nedeni, Rust'ın değiştirilebilir " +"referansların dışlayan (exclusive) olmasını gerektirmesidir, bu nedenle " +"paylaşılan bir referansın kopyasını oluşturmak geçerli olsa da, " +"değiştirilebilir bir referansın kopyasını oluşturmak Rust'ın ödünç alma " +"(borrowing) kurallarını ihlal eder." #: src/memory-management/drop.md msgid "The `Drop` Trait" -msgstr "" +msgstr "`Drop` Özelliği" #: src/memory-management/drop.md msgid "" "Values which implement [`Drop`](https://doc.rust-lang.org/std/ops/trait.Drop." "html) can specify code to run when they go out of scope:" msgstr "" +"[`Drop`](https://doc.rust-lang.org/std/ops/trait.Drop.html) özelliğini " +"gerçekleştiren (implement) değerler, kapsam (scope) dışına çıktıklarında " +"çalışacak kodu belirtebilirler:" #: src/memory-management/drop.md msgid "\"Dropping {}\"" -msgstr "" +msgstr "\"{} düşürülüyor\"" #: src/memory-management/drop.md src/concurrency/sync-exercises/link-checker.md #: src/concurrency/sync-exercises/solutions.md msgid "\"a\"" -msgstr "" +msgstr "\"a\"" #: src/memory-management/drop.md src/android/testing/googletest.md msgid "\"b\"" -msgstr "" +msgstr "\"b\"" #: src/memory-management/drop.md msgid "\"c\"" -msgstr "" +msgstr "\"c\"" #: src/memory-management/drop.md msgid "\"d\"" -msgstr "" +msgstr "\"d\"" #: src/memory-management/drop.md msgid "\"Exiting innermost block\"" -msgstr "" +msgstr "\"En içteki bloktan çıkılıyor\"" #: src/memory-management/drop.md msgid "\"Exiting next block\"" -msgstr "" +msgstr "\"Sonraki bloktan çıkılıyor\"" #: src/memory-management/drop.md msgid "\"Exiting main\"" -msgstr "" +msgstr "\"main'den çıkılıyor\"" #: src/memory-management/drop.md msgid "Note that `std::mem::drop` is not the same as `std::ops::Drop::drop`." msgstr "" +"`std::mem::drop`'un `std::ops::Drop::drop` ile aynı olmadığını unutmayın." #: src/memory-management/drop.md msgid "Values are automatically dropped when they go out of scope." -msgstr "" +msgstr "Değerler kapsam dışına çıktıklarında otomatik olarak düşürülür (drop)." #: src/memory-management/drop.md msgid "" "When a value is dropped, if it implements `std::ops::Drop` then its `Drop::" "drop` implementation will be called." msgstr "" +"Bir değer düşürüldüğünde, `std::ops::Drop`'u gerçekleştiriyorsa, `Drop::" +"drop` gerçekleştirmesi çağrılır." #: src/memory-management/drop.md msgid "" "All its fields will then be dropped too, whether or not it implements `Drop`." msgstr "" +"`Drop`'u gerçekleştirip gerçekleştirmediğine bakılmaksızın tüm alanları da " +"düşürülür." #: src/memory-management/drop.md msgid "" @@ -9411,26 +10027,35 @@ msgid "" "scope it gets dropped. This makes it a convenient way to explicitly drop " "values earlier than they would otherwise go out of scope." msgstr "" +"`std::mem::drop` sadece herhangi bir değeri alan boş bir fonksiyondur. " +"Önemi, değerin sahipliğini (ownership) almasıdır, bu yüzden kapsamının " +"(scope) sonunda düşürülür (drop). Bu, değerleri normalde kapsam dışına " +"çıkacaklarından daha erken bir zamanda açıkça düşürmenin uygun bir yoludur." #: src/memory-management/drop.md msgid "" "This can be useful for objects that do some work on `drop`: releasing locks, " "closing files, etc." msgstr "" +"Bu, `drop` üzerinde bir miktar iş yapan nesneler için yararlı olabilir: " +"kilitleri bırakma, dosyaları kapatma vb." #: src/memory-management/drop.md msgid "Why doesn't `Drop::drop` take `self`?" -msgstr "" +msgstr "`Drop::drop` neden `self` almaz?" #: src/memory-management/drop.md 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 "" +"Kısa cevap: Eğer alsaydı, bloğun sonunda `std::mem::drop` çağrılır, bu da " +"`Drop::drop`'a başka bir çağrıya ve bir yığın taşmasına (stack overflow) " +"neden olurdu!" #: src/memory-management/drop.md msgid "Try replacing `drop(a)` with `a.drop()`." -msgstr "" +msgstr "`drop(a)`'yı `a.drop()` ile değiştirmeyi deneyin." #: src/memory-management/exercise.md msgid "" @@ -9438,93 +10063,101 @@ msgid "" "data. We will use the \"builder pattern\" to support building a new value " "piece-by-piece, using convenience functions." msgstr "" +"Bu örnekte, tüm verilerine sahip olan karmaşık bir veri türü " +"gerçekleştireceğiz (implement). Yeni bir değeri parça parça, kolaylık " +"sağlayan fonksiyonlar kullanarak oluşturmayı desteklemek için \"inşa edici " +"desenini (builder pattern)\" kullanacağız." #: src/memory-management/exercise.md msgid "Fill in the missing pieces." -msgstr "" +msgstr "Eksik parçaları doldurun." #: src/memory-management/exercise.md src/memory-management/solution.md msgid "/// A representation of a software package.\n" -msgstr "" +msgstr "/// Bir yazılım paketinin bir temsili.\n" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "" "/// Return a representation of this package as a dependency, for use in\n" " /// building other packages.\n" msgstr "" +"/// Bu paketin bir bağımlılık olarak bir temsilini, diğer paketleri\n" +" /// inşa etmek (build) için döndürün.\n" #: src/memory-management/exercise.md msgid "\"1\"" -msgstr "" +msgstr "\"1\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "" "/// A builder for a Package. Use `build()` to create the `Package` itself.\n" msgstr "" +"/// Bir Paket için bir inşa edici (builder). `Package`'ın kendisini " +"oluşturmak için `build()` kullanın.\n" #: src/memory-management/exercise.md msgid "\"2\"" -msgstr "" +msgstr "\"2\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "/// Set the package version.\n" -msgstr "" +msgstr "/// Paket sürümünü ayarlayın.\n" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "/// Set the package authors.\n" -msgstr "" +msgstr "/// Paket yazarlarını ayarlayın.\n" #: src/memory-management/exercise.md msgid "\"3\"" -msgstr "" +msgstr "\"3\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "/// Add an additional dependency.\n" -msgstr "" +msgstr "/// Ek bir bağımlılık ekleyin.\n" #: src/memory-management/exercise.md msgid "\"4\"" -msgstr "" +msgstr "\"4\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "/// Set the language. If not set, language defaults to None.\n" -msgstr "" +msgstr "/// Dili ayarlayın. Ayarlanmazsa, dil varsayılan olarak None olur.\n" #: src/memory-management/exercise.md msgid "\"5\"" -msgstr "" +msgstr "\"5\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"base64\"" -msgstr "" +msgstr "\"base64\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"0.13\"" -msgstr "" +msgstr "\"0.13\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"log\"" -msgstr "" +msgstr "\"log\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"0.4\"" -msgstr "" +msgstr "\"0.4\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"serde\"" -msgstr "" +msgstr "\"serde\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"djmitche\"" -msgstr "" +msgstr "\"djmitche\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"4.0\"" -msgstr "" +msgstr "\"4.0\"" #: src/memory-management/solution.md msgid "\"0.1\"" -msgstr "" +msgstr "\"0.1\"" #: src/smart-pointers.md msgid "Box" @@ -9539,10 +10172,12 @@ msgid "" "[`Box`](https://doc.rust-lang.org/std/boxed/struct.Box.html) is an owned " "pointer to data on the heap:" msgstr "" +"[`Box`](https://doc.rust-lang.org/std/boxed/struct.Box.html), dinamik bellek " +"(heap) üzerindeki verilere sahip olunan (owned) bir göstericidir:" #: src/smart-pointers/box.md msgid "\"five: {}\"" -msgstr "" +msgstr "\"beş: {}\"" #: src/smart-pointers/box.md msgid "" @@ -9550,24 +10185,31 @@ msgid "" "methods from `T` directly on a `Box`](https://doc.rust-lang.org/std/ops/" "trait.Deref.html#more-on-deref-coercion)." msgstr "" +"`Box`, `Deref` özelliğini (trait) gerçekleştirir (implement), " +"bu da [`T`'den metotları doğrudan bir `Box` üzerinde çağırabileceğiniz]" +"(https://doc.rust-lang.org/std/ops/trait.Deref.html#more-on-deref-coercion) " +"anlamına gelir." #: src/smart-pointers/box.md msgid "" "Recursive data types or data types with dynamic sizes cannot be stored " "inline without a pointer indirection. `Box` accomplishes that indirection:" msgstr "" +"Özyinelemeli (recursive) veri türleri veya dinamik boyutlara sahip veri " +"türleri, bir gösterici dolaylılığı (pointer indirection) olmadan satır içi " +"(inline) olarak saklanamaz. `Box` bu dolaylılığı sağlar:" #: src/smart-pointers/box.md msgid "/// A non-empty list: first element and the rest of the list.\n" -msgstr "" +msgstr "/// Boş olmayan bir liste: ilk eleman ve listenin geri kalanı.\n" #: src/smart-pointers/box.md msgid "/// An empty list.\n" -msgstr "" +msgstr "/// Boş bir liste.\n" #: src/smart-pointers/box.md msgid "\"{list:?}\"" -msgstr "" +msgstr "\"{list:?}\"" #: src/smart-pointers/box.md msgid "" @@ -9590,22 +10232,44 @@ msgid "" "- - - - -'\n" "```" msgstr "" +"```bob\n" +" Yığın (Stack) Dinamik Bellek (Heap)\n" +".- - - - - - - - - - - - - - . .- - - - - - - - - - - - - - - - - - - - " +"- - - - -.\n" +": : : :\n" +": " +"liste : : :\n" +": +---------+----+----+ : : +---------+----+----+ +------+----" +"+----+ :\n" +": | Eleman | 1 | o--+----+-----+--->| Eleman | 2 | o--+--->| Yok | // " +"| // | :\n" +": +---------+----+----+ : : +---------+----+----+ +------+----" +"+----+ :\n" +": : : :\n" +": : : :\n" +"'- - - - - - - - - - - - - - ' '- - - - - - - - - - - - - - - - - - - - " +"- - - - -'\n" +"```" #: src/smart-pointers/box.md msgid "" "`Box` is like `std::unique_ptr` in C++, except that it's guaranteed to be " "not null." msgstr "" +"`Box`, C++'daki `std::unique_ptr`'e benzer, ancak null olmaması garanti " +"edilir." #: src/smart-pointers/box.md msgid "A `Box` can be useful when you:" -msgstr "" +msgstr "Bir `Box` şu durumlarda yararlı olabilir:" #: src/smart-pointers/box.md msgid "" "have a type whose size can't be known at compile time, but the Rust compiler " "wants to know an exact size." msgstr "" +"boyutu derleme zamanında bilinemeyen bir türünüz varsa, ancak Rust " +"derleyicisi tam bir boyut bilmek istiyorsa." #: src/smart-pointers/box.md msgid "" @@ -9613,6 +10277,10 @@ msgid "" "amounts of data on the stack, instead store the data on the heap in a `Box` " "so only the pointer is moved." msgstr "" +"büyük miktarda verinin sahipliğini (ownership) aktarmak istiyorsanız. Yığın " +"(stack) üzerinde büyük miktarda veri kopyalamaktan kaçınmak için, bunun " +"yerine veriyi dinamik bellekte (heap) bir `Box` içinde saklayın, böylece " +"sadece gösterici taşınır." #: src/smart-pointers/box.md msgid "" @@ -9620,12 +10288,18 @@ msgid "" "`List`, the compiler would not be able to compute a fixed size for the " "struct in memory (the `List` would be of infinite size)." msgstr "" +"`Box` kullanılmasaydı ve bir `List`'i doğrudan `List`'e gömmeye çalışsaydık, " +"derleyici bellekteki yapı (struct) için sabit bir boyut hesaplayamazdı " +"(`List` sonsuz boyutta olurdu)." #: src/smart-pointers/box.md msgid "" "`Box` solves this problem as it has the same size as a regular pointer and " "just points at the next element of the `List` in the heap." msgstr "" +"`Box`, normal bir göstericiyle aynı boyuta sahip olduğu ve dinamik " +"bellekteki (heap) `List`'in bir sonraki elemanına işaret ettiği için bu " +"sorunu çözer." #: src/smart-pointers/box.md msgid "" @@ -9634,6 +10308,10 @@ msgid "" "we have to use indirection, a `Box` or reference of some kind, instead of " "storing the value directly." msgstr "" +"Liste tanımındaki `Box`'ı kaldırın ve derleyici hatasını gösterin. " +"\"dolaylılık olmadan özyinelemeli (recursive without indirection)\" mesajını " +"alırız, çünkü veri özyinelemesi için değeri doğrudan saklamak yerine " +"dolaylılık, yani bir `Box` veya bir tür referans kullanmalıyız." #: src/smart-pointers/box.md msgid "" @@ -9641,6 +10319,9 @@ msgid "" "This makes `Box` one of the types that allow the compiler to optimize " "storage of some enums (the \"niche optimization\")." msgstr "" +"`Box` C++'daki `std::unique_ptr`'e benzese de, boş/null olamaz. Bu, `Box`'ı " +"derleyicinin bazı enumların depolanmasını optimize etmesine olanak tanıyan " +"türlerden biri yapar (\"niş optimizasyonu\")." #: src/smart-pointers/rc.md msgid "" @@ -9648,12 +10329,17 @@ msgid "" "counted shared pointer. Use this when you need to refer to the same data " "from multiple places:" msgstr "" +"[`Rc`](https://doc.rust-lang.org/std/rc/struct.Rc.html) referans sayımlı " +"(reference-counted) bir paylaşılan göstericidir. Aynı veriye birden çok " +"yerden referans vermeniz gerektiğinde bunu kullanın:" #: src/smart-pointers/rc.md msgid "" "Each `Rc` points to the same shared data structure, containing strong and " "weak pointers and the value:" msgstr "" +"Her `Rc`, güçlü (strong) ve zayıf (weak) göstericileri ve değeri içeren aynı " +"paylaşılan veri yapısına işaret eder:" #: src/smart-pointers/rc.md msgid "" @@ -9661,22 +10347,30 @@ msgid "" "rust-lang.org/std/sync/struct.Mutex.html) if you are in a multi-threaded " "context." msgstr "" +"Çok iş parçacıklı (multi-threaded) bir bağlamdaysanız [`Arc`](../concurrency/" +"shared-state/arc.md) ve [`Mutex`](https://doc.rust-lang.org/std/sync/struct." +"Mutex.html)'e bakın." #: src/smart-pointers/rc.md msgid "" "You can _downgrade_ a shared pointer into a [`Weak`](https://doc.rust-lang." "org/std/rc/struct.Weak.html) pointer to create cycles that will get dropped." msgstr "" +"Düşürülecek (drop) döngüler oluşturmak için paylaşılan bir göstericiyi bir " +"[`Weak`](https://doc.rust-lang.org/std/rc/struct.Weak.html) göstericiye " +"_düşürebilirsiniz (downgrade)_." #: src/smart-pointers/rc.md msgid "" "`Rc`'s count ensures that its contained value is valid for as long as there " "are references." msgstr "" +"`Rc`'nin sayımı, içerdiği değerin referanslar olduğu sürece geçerli olmasını " +"sağlar." #: src/smart-pointers/rc.md msgid "`Rc` in Rust is like `std::shared_ptr` in C++." -msgstr "" +msgstr "Rust'taki `Rc`, C++'daki `std::shared_ptr`'e benzer." #: src/smart-pointers/rc.md msgid "" @@ -9684,22 +10378,30 @@ msgid "" "increases the reference count. Does not make a deep clone and can generally " "be ignored when looking for performance issues in code." msgstr "" +"`Rc::clone` ucuzdur: aynı tahsise bir gösterici oluşturur ve referans " +"sayısını artırır. Derin bir klon (deep clone) yapmaz ve genellikle koddaki " +"performans sorunlarını ararken göz ardı edilebilir." #: src/smart-pointers/rc.md msgid "" "`make_mut` actually clones the inner value if necessary (\"clone-on-write\") " "and returns a mutable reference." msgstr "" +"`make_mut` aslında gerekirse iç değeri klonlar (\"yazmada-klonla / clone-on-" +"write\") ve değiştirilebilir (mutable) bir referans döndürür." #: src/smart-pointers/rc.md msgid "Use `Rc::strong_count` to check the reference count." -msgstr "" +msgstr "Referans sayısını kontrol etmek için `Rc::strong_count` kullanın." #: src/smart-pointers/rc.md msgid "" "`Rc::downgrade` gives you a _weakly reference-counted_ object to create " "cycles that will be dropped properly (likely in combination with `RefCell`)." msgstr "" +"`Rc::downgrade` size düzgün bir şekilde düşürülecek (drop) döngüler " +"oluşturmak için _zayıf referans sayımlı (weakly reference-counted)_ bir " +"nesne verir (muhtemelen `RefCell` ile kombinasyon halinde)." #: src/smart-pointers/trait-objects.md msgid "" @@ -9707,10 +10409,14 @@ msgid "" "Pet`. However, we can also use trait objects with smart pointers like `Box` " "to create an owned trait object: `Box`." msgstr "" +"Daha önce özellik nesnelerinin (trait objects) referanslarla nasıl " +"kullanılabileceğini görmüştük, örn. `&dyn Pet`. Ancak, sahip olunan (owned) " +"bir özellik nesnesi oluşturmak için `Box` gibi akıllı göstericilerle de " +"özellik nesnelerini kullanabiliriz: `Box`." #: src/smart-pointers/trait-objects.md msgid "Memory layout after allocating `pets`:" -msgstr "" +msgstr "`pets` tahsis edildikten sonraki bellek düzeni:" #: src/smart-pointers/trait-objects.md msgid "" @@ -9771,24 +10477,88 @@ msgid "" "- - - -'\n" "```" msgstr "" +"```bob\n" +" Stack Heap\n" +".- - - - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - " +"- - - -.\n" +": : : :\n" +": \"pets: Vec>\" : : \"data: Cat\" +----+----" +"+----+----+ :\n" +": +-----------+-------+ : : +-------+-------+ | F | i | d " +"| o | :\n" +": | ptr | o---+-------+--. : | lives | 9 | +----+----+----" +"+----+ :\n" +": | len | 2 | : | : +-------+-------+ " +"^ :\n" +": | capacity | 2 | : | : ^ " +"| :\n" +": +-----------+-------+ : | : | " +"'-------. :\n" +": : | : | data:" +"\"Dog\"| :\n" +": : | : | +-------" +"+--|-------+ :\n" +"`- - - - - - - - - - - - - - - -' | : +---|-+-----+ | name | o, " +"4, 4 | :\n" +" `--+-->| o o | o o-|----->| age " +"| 5 | :\n" +" : +-|---+-|---+ +-------" +"+----------+ :\n" +" : | " +"| :\n" +" `- - -| - - |- - - - - - - - - - - - - " +"- - - -'\n" +" | |\n" +" | | " +"\"Program text\"\n" +" .- - -| - - |- - - - - - - - - - - - - " +"- - - -.\n" +" : | | " +"vtable :\n" +" : | | " +"+----------------------+ :\n" +" : | `----->| \"::" +"talk\" | :\n" +" : | " +"+----------------------+ :\n" +" : | " +"vtable :\n" +" : | " +"+----------------------+ :\n" +" : '----------->| \"::" +"talk\" | :\n" +" : " +"+----------------------+ :\n" +" : :\n" +" '- - - - - - - - - - - - - - - - - - - " +"- - - -'\n" +"```" #: src/smart-pointers/trait-objects.md 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." msgstr "" +"Belirli bir özelliği (trait) gerçekleştiren türler farklı boyutlarda " +"olabilir. Bu, yukarıdaki örnekte `Vec` gibi şeylere sahip olmayı " +"imkansız kılar." #: src/smart-pointers/trait-objects.md msgid "" "`dyn Pet` is a way to tell the compiler about a dynamically sized type that " "implements `Pet`." msgstr "" +"`dyn Pet`, derleyiciye `Pet`'i gerçekleştiren dinamik boyutlu bir tür " +"hakkında bilgi vermenin bir yoludur." #: src/smart-pointers/trait-objects.md msgid "" "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 "" +"Örnekte, `pets` yığın (stack) üzerinde tahsis edilir ve vektör verisi " +"dinamik bellektedir (heap). İki vektör elemanı _genişletilmiş " +"göstericilerdir (fat pointers)_:" #: src/smart-pointers/trait-objects.md msgid "" @@ -9797,25 +10567,33 @@ msgid "" "wikipedia.org/wiki/Virtual_method_table) (vtable) for the `Pet` " "implementation of that particular object." msgstr "" +"Genişletilmiş bir gösterici (fat pointer), çift genişlikli bir göstericidir. " +"İki bileşeni vardır: gerçek nesneye bir gösterici ve o belirli nesnenin " +"`Pet` gerçekleştirmesi için [sanal metot tablosuna (virtual method table)]" +"(https://en.wikipedia.org/wiki/Virtual_method_table) (vtable) bir gösterici." #: src/smart-pointers/trait-objects.md msgid "" "The data for the `Dog` named Fido is the `name` and `age` fields. The `Cat` " "has a `lives` field." msgstr "" +"Fido adındaki `Dog` için veri, `name` ve `age` alanlarıdır. `Cat`'in bir " +"`lives` alanı vardır." #: src/smart-pointers/trait-objects.md msgid "Compare these outputs in the above example:" -msgstr "" +msgstr "Yukarıdaki örnekte bu çıktıları karşılaştırın:" #: src/smart-pointers/trait-objects.md msgid "\"{} {}\"" -msgstr "" +msgstr "\"{} {}\"" #: src/smart-pointers/trait-objects.md src/modules/exercise.md #: src/modules/solution.md src/android/build-rules/library.md #: src/android/interoperability/cpp/rust-bridge.md #: src/concurrency/async-pitfalls/cancellation.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md msgid "\"{}\"" msgstr "\"{}\"" @@ -9824,20 +10602,28 @@ msgid "" "A binary tree is a tree-type data structure where every node has two " "children (left and right). We will create a tree where each node stores a " "value. For a given node N, all nodes in a N's left subtree contain smaller " -"values, and all nodes in N's right subtree will contain larger values." +"values, and all nodes in N's right subtree will contain larger values. A " +"given value should only be stored in the tree once, i.e. no duplicate nodes." msgstr "" +"Bir ikili ağaç (binary tree), her düğümün (node) iki çocuğa (sol ve sağ) " +"sahip olduğu bir ağaç türü veri yapısıdır. Her düğümün bir değer sakladığı " +"bir ağaç oluşturacağız. Belirli bir N düğümü için, N'nin sol alt ağacındaki " +"tüm düğümler daha küçük değerler içerir ve N'nin sağ alt ağacındaki tüm " +"düğümler daha büyük değerler içerir. Belirli bir değer ağaçta yalnızca bir " +"kez saklanmalıdır, yani aynı değere sahip düğümler olmamalıdır." #: src/smart-pointers/exercise.md msgid "Implement the following types, so that the given tests pass." msgstr "" +"Aşağıdaki türleri gerçekleştirin (implement), böylece verilen testler geçer." #: src/smart-pointers/exercise.md src/smart-pointers/solution.md msgid "/// A node in the binary tree.\n" -msgstr "" +msgstr "/// İkili ağaçtaki (binary tree) bir düğüm.\n" #: src/smart-pointers/exercise.md src/smart-pointers/solution.md msgid "/// A possibly-empty subtree.\n" -msgstr "" +msgstr "/// Muhtemelen boş bir alt ağaç.\n" #: src/smart-pointers/exercise.md src/smart-pointers/solution.md msgid "" @@ -9845,22 +10631,18 @@ msgid "" "///\n" "/// If the same value is added multiple times, it is only stored once.\n" msgstr "" +"/// İkili ağaç (binary tree) kullanarak bir değerler kümesini saklayan bir " +"kap.\n" +"///\n" +"/// Aynı değer birden çok kez eklenirse, yalnızca bir kez saklanır.\n" #: src/smart-pointers/exercise.md msgid "// Implement `new`, `insert`, `len`, and `has` for `Subtree`.\n" -msgstr "" +msgstr "// `Subtree` için `new`, `insert`, `len` ve `has`'ı gerçekleştirin.\n" #: src/smart-pointers/exercise.md src/smart-pointers/solution.md msgid "// not a unique item\n" -msgstr "" - -#: src/welcome-day-3-afternoon.md -msgid "" -"Including 10 minute breaks, this session should take about 1 hour and 55 " -"minutes. It contains:" -msgstr "" -"Bu oturum 10 dakikalık aralar dahil yaklaşık 1 saat 55 dakika sürmelidir. " -"İçeriği:" +msgstr "// benzersiz bir öğe değil\n" #: src/borrowing/shared.md msgid "" @@ -9976,9 +10758,9 @@ msgstr "" #: src/borrowing/borrowck.md msgid "" -"Technically multiple mutable references to a piece of data can exist at the " +"Technically, multiple mutable references to a piece of data can exist at the " "same time via re-borrowing. This is what allows you to pass a mutable " -"reference into a function without invaliding the original reference. [This " +"reference into a function without invalidating the original reference. [This " "playground example](https://play.rust-lang.org/?" "version=stable&mode=debug&edition=2024&gist=8f5896878611566845fe3b0f4dc5af68) " "demonstrates that behavior." @@ -10150,127 +10932,259 @@ msgstr "" msgid "\"Bob\"" msgstr "" -#: src/lifetimes/lifetime-annotations.md -msgid "" -"A reference has a _lifetime_, which must not \"outlive\" the value it refers " -"to. This is verified by the borrow checker." +#: src/lifetimes.md +msgid "This segment should take about 1 hour and 5 minutes. It contains:" +msgstr "Bu bölüm yaklaşık 1 saat 5 dakika sürmelidir. İçeriği:" + +#: src/lifetimes/simple-borrows.md +msgid "Borrowing with Functions" msgstr "" -#: src/lifetimes/lifetime-annotations.md +#: src/lifetimes/simple-borrows.md msgid "" -"The lifetime can be implicit - this is what we have seen so far. Lifetimes " -"can also be explicit: `&'a Point`, `&'document str`. Lifetimes start with " -"`'` and `'a` is a typical default name. Read `&'a Point` as \"a borrowed " -"`Point` which is valid for at least the lifetime `a`\"." +"As part of borrow checking, the compiler needs to reason about how borrows " +"flow into and out of functions. In the simplest case borrows last for the " +"duration of the function call:" msgstr "" -#: src/lifetimes/lifetime-annotations.md -msgid "" -"Only ownership, not lifetime annotations, control when values are destroyed " -"and determine the concrete lifetime of a given value. The borrow checker " -"just validates that borrows never extend beyond the concrete lifetime of the " -"value." +#: src/lifetimes/simple-borrows.md +msgid "// Borrow `val` for the function call.\n" msgstr "" -#: src/lifetimes/lifetime-annotations.md -msgid "" -"Explicit lifetime annotations, like types, are required on function " -"signatures (but can be elided in common cases). These provide information " -"for inference at callsites and within the function body, helping the borrow " -"checker to do its job." +#: src/lifetimes/simple-borrows.md +msgid "// Borrow has ended and we're free to mutate.\n" msgstr "" -#: src/lifetimes/lifetime-annotations.md -msgid "// What is the lifetime of p3?\n" +#: src/lifetimes/simple-borrows.md +msgid "" +"In this example we borrow `val` for the call to `borrows`. This would limit " +"our ability to mutate `val`, but once the function call returns the borrow " +"has ended and we're free to mutate again." msgstr "" -#: src/lifetimes/lifetime-annotations.md +#: src/lifetimes/returning-borrows.md msgid "" -"In this example, the compiler does not know what lifetime to infer for `p3`. " -"Looking inside the function body shows that it can only safely assume that " -"`p3`'s lifetime is the shorter of `p1` and `p2`. But just like types, Rust " -"requires explicit annotations of lifetimes on function arguments and return " -"values." +"But we can also have our function return a reference! This means that a " +"borrow flows back out of a function:" msgstr "" -#: src/lifetimes/lifetime-annotations.md -msgid "Add `'a` appropriately to `left_most`:" +#: src/lifetimes/returning-borrows.md +msgid "// x = 5; // 🛠️❌ `x` is still borrowed!\n" msgstr "" -#: src/lifetimes/lifetime-annotations.md +#: src/lifetimes/returning-borrows.md msgid "" -"This says there is some lifetime `'a` which both `p1` and `p2` outlive, and " -"which outlives the return value. The borrow checker verifies this within the " -"function body, and uses this information in `main` to determine a lifetime " -"for `p3`." +"Rust functions can return references, meaning that a borrow can flow back " +"out of a function." msgstr "" -#: src/lifetimes/lifetime-annotations.md -msgid "Try dropping `p2` in `main` before printing `p3`." +#: src/lifetimes/returning-borrows.md +msgid "" +"If a function returns a reference (or another kind of borrow), it was likely " +"derived from one of its arguments. This means that the return value of the " +"function will extend the borrow for one or more argument borrows." msgstr "" -#: src/lifetimes/lifetime-elision.md -msgid "Lifetimes in Function Calls" -msgstr "Fonksiyon Çağrılarında Ömürler" +#: src/lifetimes/returning-borrows.md +msgid "" +"This case is still fairly simple, in that only one borrow is passed into the " +"function, so the returned borrow has to be the same one." +msgstr "" -#: src/lifetimes/lifetime-elision.md +#: src/lifetimes/multiple-borrows.md msgid "" -"Lifetimes for function arguments and return values must be fully specified, " -"but Rust allows lifetimes to be elided in most cases with [a few simple " -"rules](https://doc.rust-lang.org/nomicon/lifetime-elision.html). This is not " -"inference -- it is just a syntactic shorthand." +"But what about when there are multiple borrows passed into a function and " +"one being returned?" msgstr "" -#: src/lifetimes/lifetime-elision.md -msgid "Each argument which does not have a lifetime annotation is given one." +#: src/lifetimes/multiple-borrows.md +msgid "\"Return either `a` or `b`\"" msgstr "" -#: src/lifetimes/lifetime-elision.md +#: src/lifetimes/multiple-borrows.md msgid "" -"If there is only one argument lifetime, it is given to all un-annotated " -"return values." +"// Which one is still borrowed?\n" +" // Should either mutation be allowed?\n" msgstr "" -#: src/lifetimes/lifetime-elision.md +#: src/lifetimes/multiple-borrows.md msgid "" -"If there are multiple argument lifetimes, but the first one is for `self`, " -"that lifetime is given to all un-annotated return values." +"This code does not compile right now because it is missing lifetime " +"annotations. Before we get it to compile, use this opportunity to have " +"students to think about which of our argument borrows should be extended by " +"the return value." msgstr "" -#: src/lifetimes/lifetime-elision.md -msgid "In this example, `cab_distance` is trivially elided." +#: src/lifetimes/multiple-borrows.md +msgid "" +"We pass two borrows into `multiple` and one is going to come back out, which " +"means we will need to extend the borrow of one of the argument lifetimes. " +"Which one should be extended? Do we need to see the body of `multiple` to " +"figure this out?" msgstr "" -#: src/lifetimes/lifetime-elision.md +#: src/lifetimes/multiple-borrows.md msgid "" -"The `nearest` function provides another example of a function with multiple " -"references in its arguments that requires explicit annotation. In `main`, " -"the return value is allowed to outlive the query." +"When borrow checking, the compiler doesn't look at the body of `multiple` to " +"reason about the borrows flowing out, instead it looks only at the signature " +"of the function for borrow analysis." msgstr "" -#: src/lifetimes/lifetime-elision.md -msgid "Try adjusting the signature to \"lie\" about the lifetimes returned:" +#: src/lifetimes/multiple-borrows.md +msgid "" +"In this case there is not enough information to determine if `a` or `b` will " +"be borrowed by the returned reference. Show students the compiler errors and " +"introduce the lifetime syntax:" msgstr "" -#: src/lifetimes/lifetime-elision.md +#: src/lifetimes/borrow-both.md msgid "" -"This won't compile, demonstrating that the annotations are checked for " -"validity by the compiler. Note that this is not the case for raw pointers " -"(unsafe), and this is a common source of errors with unsafe Rust." +"In this case, we have a function where either `a` or `b` may be returned. In " +"this case we use the lifetime annotations to tell the compiler that both " +"borrows may flow into the return value." msgstr "" -#: src/lifetimes/lifetime-elision.md +#: src/lifetimes/borrow-both.md msgid "" -"Students may ask when to use lifetimes. Rust borrows _always_ have " -"lifetimes. Most of the time, elision and type inference mean these don't " -"need to be written out. In more complicated cases, lifetime annotations can " -"help resolve ambiguity. Often, especially when prototyping, it's easier to " -"just work with owned data by cloning values where necessary." +"// Which one is still borrowed?\n" +" // Should either mutation be allowed?\n" +" // a += 7;\n" +" // b += 7;\n" msgstr "" -#: src/lifetimes/struct-lifetimes.md +#: src/lifetimes/borrow-both.md msgid "" -"If a data type stores borrowed data, it must be annotated with a lifetime:" +"The `pick` function will return either `a` or `b` depending on the value of " +"`c`, which means we can't know at compile time which one will be returned." +msgstr "" + +#: src/lifetimes/borrow-both.md +msgid "" +"To express this to the compiler, we use the same lifetime for both `a` and " +"`b`, along with the return type. This means that the returned reference will " +"borrow BOTH `a` and `b`!" +msgstr "" + +#: src/lifetimes/borrow-both.md +msgid "" +"Uncomment both of the commented lines and show that `r` is borrowing both " +"`a` and `b`, even though at runtime it will only point to one of them." +msgstr "" + +#: src/lifetimes/borrow-both.md +msgid "" +"Change the first argument to `pick` to show that the result is the same " +"regardless of if `a` or `b` is returned." +msgstr "" + +#: src/lifetimes/borrow-one.md +msgid "" +"In this example `find_nearest` takes in multiple borrows but returns only " +"one of them. The lifetime annotations explicitly tie the returned borrow to " +"the corresponding argument borrow." +msgstr "" + +#: src/lifetimes/borrow-one.md +msgid "" +"/// Searches `points` for the point closest to `query`.\n" +"/// Assumes there's at least one point in `points`.\n" +msgstr "" + +#: src/lifetimes/borrow-one.md +msgid "// query // What happens if we do this instead?\n" +msgstr "" + +#: src/lifetimes/borrow-one.md +msgid "// `query` isn't borrowed at this point.\n" +msgstr "" + +#: src/lifetimes/borrow-one.md +msgid "" +"It may be helpful to collapse the definition of `find_nearest` to put more " +"focus on the signature of the function. The actual logic in the function is " +"somewhat complex and isn't important for the purpose of borrow analysis." +msgstr "" + +#: src/lifetimes/borrow-one.md +msgid "" +"When we call `find_nearest` the returned reference doesn't borrow `query`, " +"and so we are free to drop it while `nearest` is still active." +msgstr "" + +#: src/lifetimes/borrow-one.md +msgid "" +"But what happens if we return the wrong borrow? Change the last line of " +"`find_nearest` to return `query` instead. Show the compiler error to the " +"students." +msgstr "" + +#: src/lifetimes/borrow-one.md +msgid "" +"The first thing we have to do is add a lifetime annotation to `query`. Show " +"students that we can add a second lifetime `'b` to `find_nearest`." +msgstr "" + +#: src/lifetimes/borrow-one.md +msgid "" +"Show the new error to the students. The borrow checker verifies that the " +"logic in the function body actually returns a reference with the correct " +"lifetime, enforcing that the function adheres to the contract set by the " +"function's signature." +msgstr "" + +#: src/lifetimes/borrow-one.md +msgid "" +"The \"help\" note in the error notes that we can add a lifetime bound `'b: " +"'a` to say that `'b` will live at least as long as `'a`, which would then " +"allow us to return `query`. On the next slide we'll talk about lifetime " +"variance, which is the rule that allows us to return a longer lifetime when " +"a shorter one is expected." +msgstr "" + +#: src/lifetimes/lifetime-elision.md +msgid "Lifetimes in Function Calls" +msgstr "Fonksiyon Çağrılarında Ömürler" + +#: src/lifetimes/lifetime-elision.md +msgid "" +"Lifetimes for function arguments and return values must be fully specified, " +"but Rust allows lifetimes to be elided in most cases with [a few simple " +"rules](https://doc.rust-lang.org/nomicon/lifetime-elision.html). This is not " +"inference -- it is just a syntactic shorthand." +msgstr "" + +#: src/lifetimes/lifetime-elision.md +msgid "Each argument which does not have a lifetime annotation is given one." +msgstr "" + +#: src/lifetimes/lifetime-elision.md +msgid "" +"If there is only one argument lifetime, it is given to all un-annotated " +"return values." +msgstr "" + +#: src/lifetimes/lifetime-elision.md +msgid "" +"If there are multiple argument lifetimes, but the first one is for `self`, " +"that lifetime is given to all un-annotated return values." +msgstr "" + +#: src/lifetimes/lifetime-elision.md +msgid "" +"Walk through applying the lifetime elision rules to each of the example " +"functions. `only_args` is completed by the first rule, `identity` is " +"completed by the second, and `Foo::get` is completed by the third." +msgstr "" + +#: src/lifetimes/lifetime-elision.md +msgid "" +"If all lifetimes have not been filled in by applying the three elision rules " +"then you will get a compiler error telling you to add annotations manually." +msgstr "" + +#: src/lifetimes/struct-lifetimes.md +msgid "" +"If a data type stores borrowed data, it must be annotated with a lifetime:" msgstr "" #: src/lifetimes/struct-lifetimes.md @@ -10570,11 +11484,7 @@ msgid "" msgstr "" #: src/lifetimes/solution.md -msgid "\"len not a valid `usize`\"" -msgstr "" - -#: src/lifetimes/solution.md -msgid "\"Unexpected EOF\"" +msgid "// cast for simplicity\n" msgstr "" #: src/lifetimes/solution.md @@ -11160,7 +12070,7 @@ msgstr "" #: src/modules/encapsulation.md msgid "" "This slide demonstrates how privacy in structs is module-based. Students " -"coming from object oriented languages may be used to types being the " +"coming from object-oriented languages may be used to types being the " "encapsulation boundary, so this demonstrates how Rust behaves differently " "while showing how we can still achieve encapsulation." msgstr "" @@ -11638,6 +12548,7 @@ msgid "\"foo 0 0\"" msgstr "" #: src/testing/solution.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/struct.md msgid "\" \"" msgstr "" @@ -11674,11 +12585,7 @@ msgid "Exercise: Rewriting with Result" msgstr "" #: src/error-handling/panics.md -msgid "Rust handles fatal errors with a \"panic\"." -msgstr "" - -#: src/error-handling/panics.md -msgid "Rust will trigger a panic if a fatal error happens at runtime:" +msgid "In case of a fatal runtime error, Rust triggers a \"panic\":" msgstr "" #: src/error-handling/panics.md @@ -11690,11 +12597,11 @@ msgid "Panics are symptoms of bugs in the program." msgstr "" #: src/error-handling/panics.md -msgid "Runtime failures like failed bounds checks can panic" +msgid "Runtime failures like failed bounds checks can panic." msgstr "" #: src/error-handling/panics.md -msgid "Assertions (such as `assert!`) panic on failure" +msgid "Assertions (such as `assert!`) panic on failure." msgstr "" #: src/error-handling/panics.md @@ -12353,9 +13260,8 @@ msgid "Unsafe functions may come from two places:" msgstr "" #: src/unsafe-rust/unsafe-functions.md -#, fuzzy msgid "Rust functions declared unsafe." -msgstr "Rust fonksiyonları `unsafe fn` ile emniyetli olmadığı bildirildi." +msgstr "" #: src/unsafe-rust/unsafe-functions.md msgid "Unsafe foreign functions in `extern \"C\"` blocks." @@ -12942,7 +13848,7 @@ msgid "" msgstr "" #: src/android/build-rules.md -msgid "The Android build system (Soong) supports Rust via a number of modules:" +msgid "The Android build system (Soong) supports Rust through several modules:" msgstr "" #: src/android/build-rules.md @@ -13029,20 +13935,20 @@ msgstr "" msgid "We will look at `rust_binary` and `rust_library` next." msgstr "" -#: src/android/build-rules.md src/idiomatic/leveraging-the-type-system.md -msgid "Additional items speaker may mention:" +#: src/android/build-rules.md +msgid "Additional items the speaker may mention:" msgstr "" #: src/android/build-rules.md msgid "" -"Cargo is not optimized for multi-language repos, and also downloads packages " -"from the internet." +"Cargo is not optimized for multi-language repositories, and also downloads " +"packages from the internet." msgstr "" #: src/android/build-rules.md msgid "" "For compliance and performance, Android must have crates in-tree. It must " -"also interop with C/C++/Java code. Soong fills that gap." +"also interoperate with C/C++/Java code. Soong fills that gap." msgstr "" #: src/android/build-rules.md @@ -13061,7 +13967,7 @@ msgstr "" #: src/android/build-rules/binary.md msgid "" -"Let us start with a simple application. At the root of an AOSP checkout, " +"Let's start with a simple application. At the root of an AOSP checkout, " "create the following files:" msgstr "" @@ -13121,8 +14027,8 @@ msgstr "" #: src/android/build-rules/binary.md msgid "" -"Stress that the Rust build rules look like the other Soong rules. This is on " -"purpose to make it as easy to use Rust as C++ or Java." +"Stress that the Rust build rules look like the other Soong rules. This is by " +"design, to make using Rust as easy as C++ or Java." msgstr "" #: src/android/build-rules/library.md @@ -13219,12 +14125,12 @@ msgstr "" #: src/android/aidl.md msgid "" -"The [Android Interface Definition Language (AIDL)](https://developer.android." -"com/guide/components/aidl) is supported in Rust:" +"Rust supports the [Android Interface Definition Language (AIDL)](https://" +"developer.android.com/guide/components/aidl):" msgstr "" #: src/android/aidl.md -msgid "Rust code can call existing AIDL servers," +msgid "Rust code can call existing AIDL servers." msgstr "" #: src/android/aidl.md @@ -13232,20 +14138,19 @@ msgid "You can create new AIDL servers in Rust." msgstr "" #: src/android/aidl.md -msgid "AIDL is what enables Android apps to interact with each other." +msgid "AIDL enables Android apps to interact with each other." msgstr "" #: src/android/aidl.md msgid "" -"Since Rust is supported as a first-class citizen in this ecosystem, Rust " -"services can be called by any other process on the phone." +"Since Rust is a first-class citizen in this ecosystem, other processes on " +"the device can call Rust services." msgstr "" #: src/android/aidl/birthday-service.md msgid "" -"To illustrate how to use Rust with Binder, we're going to walk through the " -"process of creating a Binder interface. We're then going to both implement " -"the described service and write client code that talks to that service." +"To illustrate using Rust with Binder, we will create a Binder interface. " +"Then, we'll implement the service and write a client that talks to it." msgstr "" #: src/android/aidl/example-service/interface.md @@ -13320,7 +14225,7 @@ msgstr "" #: src/android/aidl/example-service/service-bindings.md msgid "" "Point out how the generated function signature, specifically the argument " -"and return types, correspond the interface definition." +"and return types, correspond to the interface definition." msgstr "" #: src/android/aidl/example-service/service-bindings.md @@ -13394,7 +14299,7 @@ msgstr "" #: src/android/aidl/example-service/service.md msgid "" -"This is necessary because binder responds to incoming requests on a thread " +"This is necessary because Binder responds to incoming requests on a thread " "pool, allowing for multiple requests to be processed in parallel. This " "requires that the service methods only get a shared reference to `self`." msgstr "" @@ -13414,7 +14319,7 @@ msgstr "" #: src/android/aidl/example-service/service.md msgid "" "TODO: What does the `binder::Interface` trait do? Are there methods to " -"override? Where source?" +"override? Where is the source?" msgstr "" #: src/android/aidl/example-service/server.md @@ -13456,9 +14361,9 @@ msgstr "" #: src/android/aidl/example-service/server.md msgid "" -"The process for taking a user-defined service implementation (in this case " +"The process for taking a user-defined service implementation (in this case, " "the `BirthdayService` type, which implements the `IBirthdayService`) and " -"starting it as a Binder service has multiple steps, and may appear more " +"starting it as a Binder service has multiple steps. This may appear more " "complicated than students are used to if they've used Binder from C++ or " "another language. Explain to students why each step is necessary." msgstr "" @@ -13469,11 +14374,11 @@ msgstr "" #: src/android/aidl/example-service/server.md msgid "" -"Wrap the service object in corresponding `Bn*` type (`BnBirthdayService` in " -"this case). This type is generated by Binder and provides the common Binder " -"functionality that would be provided by the `BnBinder` base class in C++. We " -"don't have inheritance in Rust, so instead we use composition, putting our " -"`BirthdayService` within the generated `BnBinderService`." +"Wrap the service object in the corresponding `Bn*` type (`BnBirthdayService` " +"in this case). This type is generated by Binder and provides common Binder " +"functionality, similar to the `BnBinder` base class in C++. Since Rust " +"doesn't have inheritance, we use composition, putting our `BirthdayService` " +"within the generated `BnBinderService`." msgstr "" #: src/android/aidl/example-service/server.md @@ -13600,8 +14505,8 @@ msgstr "" #: src/android/aidl/example-service/changing-definition.md msgid "" -"Let us extend the API with more functionality: we want to let clients " -"specify a list of lines for the birthday card:" +"Let's extend the API: we'll let clients specify a list of lines for the " +"birthday card:" msgstr "" #: src/android/aidl/example-service/changing-definition.md @@ -13753,7 +14658,7 @@ msgstr "" #: src/android/aidl/types/arrays.md msgid "" -"The array types (`T[]`, `byte[]`, and `List`) get translated to the " +"The array types (`T[]`, `byte[]`, and `List`) are translated to the " "appropriate Rust array type depending on how they are used in the function " "signature:" msgstr "" @@ -14256,8 +15161,8 @@ msgstr "" #: src/android/interoperability.md msgid "" -"When you call functions in a foreign language we say that you're using a " -"_foreign function interface_, also known as FFI." +"When you call functions in a foreign language, you're using a _foreign " +"function interface_, also known as FFI." msgstr "" #: src/android/interoperability.md @@ -14317,9 +15222,9 @@ msgstr "" #: src/android/interoperability/with-c.md msgid "" -"The `safe fn abs` part tells that Rust that `abs` is a safe function. By " -"default, extern functions are considered unsafe, but since `abs(x)` is valid " -"for any `x`, we can declare it safe." +"The `safe fn abs` part tells Rust that `abs` is a safe function. By default, " +"extern functions are unsafe, but since `abs(x)` can't trigger undefined " +"behavior with any `x`, we can declare it safe." msgstr "" #: src/android/interoperability/with-c/c-library.md @@ -14579,8 +15484,8 @@ msgstr "" #: src/android/interoperability/cpp.md msgid "" -"The [CXX crate](https://cxx.rs/) makes it possible to do safe " -"interoperability between Rust and C++." +"The [CXX crate](https://cxx.rs/) enables safe interoperability between Rust " +"and C++." msgstr "" #: src/android/interoperability/cpp.md @@ -15113,7 +16018,7 @@ msgstr "" #: src/chromium.md msgid "" "Today, we'll call into Rust to do something silly with strings. If you've " -"got a corner of the code where you're displaying a UTF8 string to the user, " +"got a corner of the code where you're displaying a UTF-8 string to the user, " "feel free to follow this recipe in your part of the codebase instead of the " "exact part we talk about." msgstr "" @@ -15148,7 +16053,7 @@ msgstr "Alıştırmalar hakkında" #: src/chromium/setup.md msgid "" -"This part of the course has a series of exercises which build on each other. " +"This part of the course has a series of exercises that build on each other. " "We'll be doing them spread throughout the course instead of just at the end. " "If you don't have time to complete a certain part, don't worry: you can " "catch up in the next slot." @@ -15274,9 +16179,8 @@ msgstr "" msgid "" "Perhaps surprisingly, Rust is becoming increasingly popular in the industry " "for writing command line tools. The breadth and ergonomics of libraries is " -"comparable to Python, while being more robust (thanks to the rich " -"typesystem) and running faster (as a compiled, rather than interpreted " -"language)." +"comparable to Python, while being more robust (thanks to the rich type " +"system) and running faster (as a compiled, rather than interpreted language)." msgstr "" #: src/chromium/cargo.md @@ -15652,7 +16556,7 @@ msgstr "" #: src/exercises/chromium/build-rules.md msgid "" -"**Important**: note that `no_mangle` here is considered a type of unsafety " +"**Important:** note that `no_mangle` here is considered a type of unsafety " "by the Rust compiler, so you'll need to allow unsafe code in your `gn` " "target." msgstr "" @@ -15799,10 +16703,10 @@ msgstr "" #: src/chromium/testing.md msgid "" -"Hypothetical/WIP PNG integration may need to implement memory-safe " -"implementation of pixel transformations that are provided by `libpng` but " -"missing in the `png` crate - e.g. RGBA => BGRA, or gamma correction. Such " -"functionality may benefit from separate tests authored in Rust." +"Hypothetical/WIP PNG integration may need memory-safe implementations of " +"pixel transformations that are provided by `libpng` but missing in the `png` " +"crate - e.g. RGBA => BGRA, or gamma correction. Such functionality may " +"benefit from separate tests authored in Rust." msgstr "" #: src/chromium/testing/rust-gtest-interop.md @@ -16005,7 +16909,7 @@ msgstr "" msgid "" "`rust::String` and `CxxString` types understand and maintain differences in " "string representation across the languages (e.g. `rust::String::lossy` can " -"build a Rust string from non-UTF8 input and `rust::String::c_str` can NUL-" +"build a Rust string from non-UTF-8 input and `rust::String::c_str` can NUL-" "terminate a string)." msgstr "" @@ -16053,7 +16957,7 @@ msgstr "" #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "" -"**Common misconception**: It _looks_ like a C++ header is being parsed by " +"**Common misconception:** It _looks_ like a C++ header is being parsed by " "Rust, but this is misleading. This header is never interpreted by Rust, but " "simply `#include`d in the generated C++ code for the benefit of C++ " "compilers." @@ -16962,7 +17866,7 @@ msgstr "" #: src/chromium/adding-third-party-crates/checking-in.md msgid "" -"**Important**: you need to use `git add -f` because otherwise `.gitignore` " +"**Important:** you need to use `git add -f` because otherwise `.gitignore` " "files may result in some files being skipped." msgstr "" @@ -17115,9 +18019,9 @@ msgstr "" #: src/exercises/chromium/bringing-it-together.md msgid "" -"UTF16 vs UTF8. Students should be aware that Rust strings are always UTF8, " -"and will probably decide that it's better to do the conversion on the C++ " -"side using `base::UTF16ToUTF8` and back again." +"UTF-16 vs UTF-8. Students should be aware that Rust strings are always " +"UTF-8, and will probably decide that it's better to do the conversion on the " +"C++ side using `base::UTF16ToUTF8` and back again." msgstr "" #: src/exercises/chromium/bringing-it-together.md @@ -17159,6 +18063,14 @@ msgid "" "(https://chromium-review.googlesource.com/c/chromium/src/+/5096560)." msgstr "" +#: src/exercises/chromium/solutions.md +msgid "" +"Or, if you'd prefer \"standalone\" solutions that don't require applying " +"patchsets or integration with core Chromium code, you can find them in the " +"[`//chromium/src/codelabs/rust` subdirectory in Chromium](https://source." +"chromium.org/chromium/chromium/src/+/main:codelabs/rust/)." +msgstr "" + #: src/bare-metal.md msgid "Welcome to Bare Metal Rust" msgstr "" @@ -17494,20 +18406,19 @@ msgstr "" #: src/bare-metal/microcontrollers/pacs.md msgid "" "SVD (System View Description) files are XML files typically provided by " -"silicon vendors which describe the memory map of the device." +"silicon vendors that describe the memory map of the device." msgstr "" #: src/bare-metal/microcontrollers/pacs.md msgid "" -"They are organised by peripheral, register, field and value, with names, " +"They are organized by peripheral, register, field and value, with names, " "descriptions, addresses and so on." msgstr "" #: src/bare-metal/microcontrollers/pacs.md msgid "" -"SVD files are often buggy and incomplete, so there are various projects " -"which patch the mistakes, add missing details, and publish the generated " -"crates." +"SVD files are often buggy and incomplete, so there are various projects that " +"patch the mistakes, add missing details, and publish the generated crates." msgstr "" #: src/bare-metal/microcontrollers/pacs.md @@ -17560,7 +18471,7 @@ msgstr "" #: src/bare-metal/microcontrollers/board-support.md msgid "" "In this case the board support crate is just providing more useful names, " -"and a bit of initialisation." +"and a bit of initialization." msgstr "" #: src/bare-metal/microcontrollers/board-support.md @@ -17588,22 +18499,22 @@ msgstr "" #: src/bare-metal/microcontrollers/type-state.md msgid "" "Pins don't implement `Copy` or `Clone`, so only one instance of each can " -"exist. Once a pin is moved out of the port struct nobody else can take it." +"exist. Once a pin is moved out of the port struct, nobody else can take it." msgstr "" #: src/bare-metal/microcontrollers/type-state.md msgid "" "Changing the configuration of a pin consumes the old pin instance, so you " -"can’t keep use the old instance afterwards." +"can't use the old instance afterwards." msgstr "" #: src/bare-metal/microcontrollers/type-state.md msgid "" -"The type of a value indicates the state that it is in: e.g. in this case, " -"the configuration state of a GPIO pin. This encodes the state machine into " -"the type system, and ensures that you don't try to use a pin in a certain " -"way without properly configuring it first. Illegal state transitions are " -"caught at compile time." +"The type of a value indicates the state it is in: e.g., in this case, the " +"configuration state of a GPIO pin. This encodes the state machine into the " +"type system and ensures that you don't try to use a pin in a certain way " +"without properly configuring it first. Illegal state transitions are caught " +"at compile time." msgstr "" #: src/bare-metal/microcontrollers/type-state.md @@ -17655,8 +18566,8 @@ msgstr "" #: src/bare-metal/microcontrollers/embedded-hal.md msgid "" -"The traits cover using the peripherals but not initialising or configuring " -"them, as initialisation and configuration is usually highly platform-" +"The traits cover using the peripherals but not initializing or configuring " +"them, as initialization and configuration is usually highly platform-" "specific." msgstr "" @@ -17727,8 +18638,8 @@ msgstr "" #: src/bare-metal/microcontrollers/probe-rs.md msgid "" -"probe-rs is a library which you can integrate into your own tools if you " -"want to." +"probe-rs is a library that you can integrate into your own tools if you want " +"to." msgstr "" #: src/bare-metal/microcontrollers/probe-rs.md @@ -17745,7 +18656,7 @@ msgstr "" #: src/bare-metal/microcontrollers/probe-rs.md msgid "" "RTT (Real Time Transfers) is a mechanism to transfer data between the debug " -"host and the target through a number of ringbuffers." +"host and the target through a number of ring buffers." msgstr "" #: src/bare-metal/microcontrollers/debugging.md @@ -18045,7 +18956,7 @@ msgstr "" #: src/bare-metal/aps/entry-point.md msgid "" -"Before we can start running Rust code, we need to do some initialisation." +"Before we can start running Rust code, we need to do some initialization." msgstr "" #: src/bare-metal/aps/entry-point.md @@ -18147,22 +19058,22 @@ msgstr "" #: src/bare-metal/aps/entry-point.md msgid "" -"This is the same as it would be for C: initialising the processor state, " +"This is the same as it would be for C: initializing the processor state, " "zeroing the BSS, and setting up the stack pointer." msgstr "" #: src/bare-metal/aps/entry-point.md msgid "" "The BSS (block starting symbol, for historical reasons) is the part of the " -"object file which containing statically allocated variables which are " -"initialised to zero. They are omitted from the image, to avoid wasting space " +"object file that contains statically allocated variables that are " +"initialized to zero. They are omitted from the image, to avoid wasting space " "on zeroes. The compiler assumes that the loader will take care of zeroing " "them." msgstr "" #: src/bare-metal/aps/entry-point.md msgid "" -"The BSS may already be zeroed, depending on how memory is initialised and " +"The BSS may already be zeroed, depending on how memory is initialized and " "the image is loaded, but we zero it to be sure." msgstr "" @@ -18175,7 +19086,7 @@ msgstr "" #: src/bare-metal/aps/entry-point.md msgid "" "Unaligned accesses will fault. We build the Rust code for the `aarch64-" -"unknown-none` target which sets `+strict-align` to prevent the compiler " +"unknown-none` target that sets `+strict-align` to prevent the compiler from " "generating unaligned accesses, so it should be fine in this case, but this " "is not necessarily the case in general." msgstr "" @@ -18193,7 +19104,7 @@ msgstr "" #: src/bare-metal/aps/entry-point.md msgid "" -"For simplicity, we just use a hardcoded pagetable (see `idmap.S`) which " +"For simplicity, we just use a hardcoded pagetable (see `idmap.S`) that " "identity maps the first 1 GiB of address space for devices, the next 1 GiB " "for DRAM, and another 1 GiB higher up for more devices. This matches the " "memory layout that QEMU uses." @@ -18208,7 +19119,7 @@ msgstr "" #: src/bare-metal/aps/entry-point.md msgid "" "All examples this afternoon assume we will be running at exception level 1 " -"(EL1). If you need to run at a different exception level you'll need to " +"(EL1). If you need to run at a different exception level, you'll need to " "modify `entry.S` accordingly." msgstr "" @@ -18280,7 +19191,7 @@ msgstr "" #: src/bare-metal/aps/inline-assembly.md msgid "" -"The `0 => _` syntax means initialise the register to 0 before running the " +"The `0 => _` syntax means initialize the register to 0 before running the " "inline assembly code, and ignore its contents afterwards. We need to use " "`inout` rather than `in` because the call could potentially clobber the " "contents of the registers." @@ -18296,8 +19207,8 @@ msgstr "" msgid "" "Just `#[no_mangle]` would be sufficient but [RFC3325](https://rust-lang." "github.io/rfcs/3325-unsafe-attributes.html) uses this notation to draw " -"reviewer attention to attributes which might cause undefined behavior if " -"used incorrectly." +"reviewer attention to attributes that might cause undefined behavior if used " +"incorrectly." msgstr "" #: src/bare-metal/aps/inline-assembly.md @@ -18360,7 +19271,7 @@ msgstr "" #: src/bare-metal/aps/mmio.md msgid "" "Some existing crates for volatile access to hardware do hold references, but " -"this is unsound. Whenever a reference exist, the compiler may choose to " +"this is unsound. Whenever a reference exists, the compiler may choose to " "dereference it." msgstr "" @@ -18527,11 +19438,11 @@ msgstr "" #: src/bare-metal/aps/better-uart.md msgid "" -"The PL011 actually has [a bunch more registers](https://developer.arm.com/" +"The PL011 actually has [more registers](https://developer.arm.com/" "documentation/ddi0183/g/programmers-model/summary-of-registers), and adding " "offsets to construct pointers to access them is error-prone and hard to " -"read. Plus, some of them are bit fields which would be nice to access in a " -"structured way." +"read. Additionally, some of them are bit fields, which would be nice to " +"access in a structured way." msgstr "" #: src/bare-metal/aps/better-uart.md @@ -18691,7 +19602,7 @@ msgid "3" msgstr "3" #: src/bare-metal/aps/better-uart.md -msgid "There are also some ID registers which have been omitted for brevity." +msgid "There are also some ID registers that have been omitted for brevity." msgstr "" #: src/bare-metal/aps/better-uart/bitflags.md @@ -18829,7 +19740,7 @@ msgstr "" #: src/bare-metal/aps/safemmio/registers.md msgid "" "The [`safe-mmio`](https://crates.io/crates/safe-mmio) crate provides types " -"to wrap registers which can be read or written safely." +"to wrap registers that can be read or written safely." msgstr "" #: src/bare-metal/aps/safemmio/registers.md @@ -18901,7 +19812,7 @@ msgstr "" msgid "" "The difference between `ReadPure` or `ReadOnly` (and likewise between " "`ReadPureWrite` and `ReadWrite`) is whether reading a register can have side-" -"effects which change the state of the device. E.g. reading the data register " +"effects that change the state of the device, e.g., reading the data register " "pops a byte from the receive FIFO. `ReadPure` means that reads have no side-" "effects, they are purely reading data." msgstr "" @@ -18936,7 +19847,7 @@ msgid "" "These MMIO accesses are generally a wrapper around `read_volatile` and " "`write_volatile`, though on aarch64 they are instead implemented in assembly " "to work around a bug where the compiler can emit instructions that prevent " -"MMIO virtualisation." +"MMIO virtualization." msgstr "" #: src/bare-metal/aps/safemmio/driver.md @@ -18949,14 +19860,14 @@ msgstr "" #: src/bare-metal/aps/safemmio/driver.md msgid "" "`field!` needs a mutable reference to a `UniqueMmioPointer`, and returns a " -"`UniqueMmioPointer` which allows reads with side effects and writes." +"`UniqueMmioPointer` that allows reads with side effects and writes." msgstr "" #: src/bare-metal/aps/safemmio/driver.md msgid "" "`field_shared!` works with a shared reference to either a " "`UniqueMmioPointer` or a `SharedMmioPointer`. It returns a " -"`SharedMmioPointer` which only allows pure reads." +"`SharedMmioPointer` that only allows pure reads." msgstr "" #: src/bare-metal/aps/safemmio/using.md @@ -19005,7 +19916,7 @@ msgstr "" #: src/bare-metal/aps/logging.md msgid "" -"The first unwrap in `log` will succeed because we initialise `LOGGER` before " +"The first unwrap in `log` will succeed because we initialize `LOGGER` before " "calling `set_logger`. The second will succeed because `Uart::write_str` " "always returns `Ok`." msgstr "" @@ -19143,13 +20054,13 @@ msgstr "" #: src/bare-metal/aps/other-projects.md msgid "" -"Initialisation, UART driver, simple bootloader, JTAG, exception levels, " +"Initialization, UART driver, simple bootloader, JTAG, exception levels, " "exception handling, page tables." msgstr "" #: src/bare-metal/aps/other-projects.md msgid "" -"Some dodginess around cache maintenance and initialisation in Rust, not " +"Some caveats around cache maintenance and initialization in Rust, not " "necessarily a good example to copy for production code." msgstr "" @@ -19175,7 +20086,7 @@ msgstr "Kullanışlı kasalar (crates)" #: src/bare-metal/useful-crates.md msgid "" -"We'll look at a few crates which solve some common problems in bare-metal " +"We'll look at a few crates that solve some common problems in bare-metal " "programming." msgstr "" @@ -19253,8 +20164,8 @@ msgstr "" #: src/bare-metal/useful-crates/buddy_system_allocator.md msgid "" "[`buddy_system_allocator`](https://crates.io/crates/buddy_system_allocator) " -"is a crate implementing a basic buddy system allocator. It can be used both " -"to implement [`GlobalAlloc`](https://doc.rust-lang.org/core/alloc/trait." +"is a crate that implements a basic buddy system allocator. It can be used " +"both to implement [`GlobalAlloc`](https://doc.rust-lang.org/core/alloc/trait." "GlobalAlloc.html) (using [`LockedHeap`](https://docs.rs/" "buddy_system_allocator/0.9.0/buddy_system_allocator/struct.LockedHeap.html)) " "so you can use the standard `alloc` crate (as we saw [before](../alloc.md)), " @@ -19276,17 +20187,17 @@ msgstr "" #: src/bare-metal/useful-crates/tinyvec.md msgid "" -"Sometimes you want something which can be resized like a `Vec`, but without " +"Sometimes you want something that can be resized like a `Vec`, but without " "heap allocation. [`tinyvec`](https://crates.io/crates/tinyvec) provides " "this: a vector backed by an array or slice, which could be statically " -"allocated or on the stack, which keeps track of how many elements are used " +"allocated or on the stack, that keeps track of how many elements are used " "and panics if you try to use more than are allocated." msgstr "" #: src/bare-metal/useful-crates/tinyvec.md msgid "" "`tinyvec` requires that the element type implement `Default` for " -"initialisation." +"initialization." msgstr "" #: src/bare-metal/useful-crates/tinyvec.md @@ -19314,13 +20225,13 @@ msgstr "" #: src/bare-metal/useful-crates/spin.md msgid "" "`spin` also has a ticket lock mutex implementation; equivalents of `RwLock`, " -"`Barrier` and `Once` from `std::sync`; and `Lazy` for lazy initialisation." +"`Barrier` and `Once` from `std::sync`; and `Lazy` for lazy initialization." msgstr "" #: src/bare-metal/useful-crates/spin.md msgid "" "The [`once_cell`](https://crates.io/crates/once_cell) crate also has some " -"useful types for late initialisation with a slightly different approach to " +"useful types for late initialization with a slightly different approach to " "`spin::once::Once`." msgstr "" @@ -21560,8 +22471,8 @@ msgid "" "[dependencies]\n" "futures-util = { version = \"0.3.31\", features = [\"sink\"] }\n" "http = \"1.3.1\"\n" -"tokio = { version = \"1.47.1\", features = [\"full\"] }\n" -"tokio-websockets = { version = \"0.12.1\", features = [\"client\", " +"tokio = { version = \"1.48.0\", features = [\"full\"] }\n" +"tokio-websockets = { version = \"0.13.0\", features = [\"client\", " "\"fastrand\", \"server\", \"sha1_smol\"] }\n" "```" msgstr "" @@ -21748,9 +22659,8 @@ msgid "\"From server: {}\"" msgstr "" #: src/idiomatic/welcome.md -#, fuzzy msgid "Welcome to Idiomatic Rust" -msgstr "Comprehensive Rust'a Hoş Geldiniz 🦀" +msgstr "" #: src/idiomatic/welcome.md msgid "" @@ -21780,14 +22690,17 @@ msgid "" msgstr "" #: src/idiomatic/welcome.md -#, fuzzy msgid "" -"Including 10 minute breaks, this session should take about 25 minutes. It " -"contains:" +"Including 10 minute breaks, this session should take about 5 hours and 5 " +"minutes. It contains:" msgstr "" -"Bu oturum 10 dakikalık aralar dahil yaklaşık 2 saat 45 dakika sürmelidir. " +"Bu oturum 10 dakikalık aralar dahil yaklaşık 5 saat 5 dakika sürmelidir. " "İçeriği:" +#: src/idiomatic/welcome.md +msgid "5 hours and 5 minutes" +msgstr "5 saat 5 dakika" + #: src/idiomatic/welcome.md msgid "" "The course will cover the topics listed below. Each topic may be covered in " @@ -21915,9 +22828,8 @@ msgid "" msgstr "" #: src/idiomatic/welcome.md -#, fuzzy msgid "Interior mutability (Cell, RefCell)" -msgstr "İç Değişebilirlik (Interior Mutability)" +msgstr "İç Değişebilirlik (Interior mutability / Cell, RefCell)" #: src/idiomatic/welcome.md msgid "Working with lifetime parameters on user-defined data types" @@ -21984,9 +22896,8 @@ msgid "Result vs. Option" msgstr "" #: src/idiomatic/welcome.md -#, fuzzy msgid "Designing good errors:" -msgstr "Kütüphane Tasarlama" +msgstr "" #: src/idiomatic/welcome.md msgid "Determine the error scope." @@ -22031,6 +22942,10 @@ msgid "" "of the entire codebase." msgstr "" +#: src/idiomatic/leveraging-the-type-system.md +msgid "Additional items speaker may mention:" +msgstr "" + #: src/idiomatic/leveraging-the-type-system.md msgid "" "Rust's type system borrows a lot of ideas from functional programming " @@ -22082,10 +22997,16 @@ msgid "" msgstr "" #: src/idiomatic/leveraging-the-type-system.md -#: src/unsafe-deep-dive/foundations.md -#, fuzzy -msgid "This segment should take about 25 minutes. It contains:" -msgstr "Bu bölüm yaklaşık 15 dakika sürmelidir. İçeriği:" +msgid "This segment should take about 5 hours and 5 minutes. It contains:" +msgstr "Bu bölüm yaklaşık 5 saat 5 dakika sürmelidir. İçeriği:" + +#: src/idiomatic/leveraging-the-type-system.md +msgid "1 hour and 30 minutes" +msgstr "1 saat 30 dakika" + +#: src/idiomatic/leveraging-the-type-system.md +msgid "1 hour and 35 minutes" +msgstr "1 saat 35 dakika" #: src/idiomatic/leveraging-the-type-system/newtype-pattern.md msgid "A _newtype_ is a wrapper around an existing type, often a primitive:" @@ -22102,6 +23023,7 @@ msgstr "" #: src/idiomatic/leveraging-the-type-system/newtype-pattern.md #: src/idiomatic/leveraging-the-type-system/newtype-pattern/semantic-confusion.md +#: src/idiomatic/leveraging-the-type-system/extension-traits.md msgid "// 🛠️❌\n" msgstr "" @@ -22145,6 +23067,10 @@ msgid "" msgstr "" #: src/idiomatic/leveraging-the-type-system/newtype-pattern/semantic-confusion.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/root.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/struct.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/property.md msgid "// [...]\n" msgstr "" @@ -22294,211 +23220,2838 @@ msgid "" "audit." msgstr "" -#: src/unsafe-deep-dive/welcome.md -#, fuzzy -msgid "Welcome to Unsafe Rust" -msgstr "1. Gün'e Hoş Geldiniz" +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "" +"It may desirable to **extend** foreign types with new inherent methods. For " +"example, allow your code to check if a string is a palindrome using method-" +"calling syntax: `s.is_palindrome()`." +msgstr "" -#: src/unsafe-deep-dive/welcome.md -msgid "IMPORTANT: THIS MODULE IS IN AN EARLY STAGE OF DEVELOPMENT" +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "It might feel natural to reach out for an `impl` block:" msgstr "" -#: src/unsafe-deep-dive/welcome.md +#: src/idiomatic/leveraging-the-type-system/extension-traits.md msgid "" -"Please do not consider this module of Comprehensive Rust to be complete. " -"With that in mind, your feedback, comments, and especially your concerns, " -"are very welcome." +"The Rust compiler won't allow it, though. But you can use the **extension " +"trait pattern** to work around this limitation." msgstr "" -#: src/unsafe-deep-dive/welcome.md -msgid "" -"To comment on this module's development, please use the [GitHub issue " -"tracker](https://github.com/google/comprehensive-rust/issues)." +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "A Rust item (be it a trait or a type) is referred to as:" msgstr "" -#: src/unsafe-deep-dive/welcome.md -msgid "" -"The `unsafe` keyword is easy to type, but hard to master. When used " -"appropriately, it forms a useful and indeed essential part of the Rust " -"programming language." +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "**foreign**, if it isn't defined in the current crate" msgstr "" -#: src/unsafe-deep-dive/welcome.md -msgid "" -"By the end of this deep dive, you'll know how to work with `unsafe` code, " -"review others' changes that include the `unsafe` keyword, and produce your " -"own." +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "**local**, if it is defined in the current crate" msgstr "" -#: src/unsafe-deep-dive/welcome.md -#, fuzzy -msgid "What you'll learn:" -msgstr "Ne görüyorsunuz:" +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "" +"The distinction has significant implications for [coherence and orphan rules]" +"(https://doc.rust-lang.org/stable/reference/items/implementations.html#r-" +"items.impl.trait.orphan-rule), as we'll get a chance to explore in this " +"section of the course." +msgstr "" -#: src/unsafe-deep-dive/welcome.md -msgid "What the terms undefined behavior, soundness, and safety mean" +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "Compile the example to show the compiler error that's emitted." msgstr "" -#: src/unsafe-deep-dive/welcome.md -msgid "Why the `unsafe` keyword exists in the Rust language" +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "" +"Highlight how the compiler error message nudges you towards the extension " +"trait pattern." msgstr "" -#: src/unsafe-deep-dive/welcome.md -msgid "How to write your own code using `unsafe` safely" +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "" +"Explain how many type-system restrictions in Rust aim to prevent _ambiguity_." msgstr "" -#: src/unsafe-deep-dive/welcome.md -msgid "How to review `unsafe` code" +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "" +"What would happen if you were allowed to define new inherent methods on " +"foreign types? Different crates in your dependency tree might end up " +"defining different methods on the same foreign type with the same name." msgstr "" -#: src/unsafe-deep-dive/welcome.md -msgid "Links to other sections of the course" +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "" +"As soon as there is room for ambiguity, there must be a way to disambiguate. " +"If disambiguation happens implicitly, it can lead to surprising or otherwise " +"unexpected behavior. If disambiguation happens explicitly, it can increase " +"the cognitive load on developers who are reading your code." msgstr "" -#: src/unsafe-deep-dive/welcome.md -msgid "The `unsafe` keyword has treatment in:" +#: src/idiomatic/leveraging-the-type-system/extension-traits.md +msgid "" +"Furthermore, every time a crate defines a new inherent method on a foreign " +"type, it may cause compilation errors in _your_ code, as you may be forced " +"to introduce explicit disambiguation." msgstr "" -#: src/unsafe-deep-dive/welcome.md +#: src/idiomatic/leveraging-the-type-system/extension-traits.md msgid "" -"_Rust Fundamentals_, the main module of Comprehensive Rust, includes a " -"session on [Unsafe Rust](../unsafe-rust.html) in its last day." +"Rust has decided to avoid the issue altogether by forbidding the definition " +"of new inherent methods on foreign types." msgstr "" -#: src/unsafe-deep-dive/welcome.md +#: src/idiomatic/leveraging-the-type-system/extension-traits.md msgid "" -"_Rust in Chromium_ discusses how to [interoperate with C++](../chromium/" -"interoperability-with-cpp.md). Consult that material if you are looking into " -"FFI." +"Other languages (e.g, Kotlin, C#, Swift) allow adding methods to existing " +"types, often called \"extension methods.\" This leads to different trade-" +"offs in terms of potential ambiguities and the need for global reasoning." msgstr "" -#: src/unsafe-deep-dive/welcome.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md msgid "" -"_Bare Metal Rust_ uses unsafe heavily to interact with the underlying host, " -"among other things." +"An **extension trait** is a local trait definition whose primary purpose is " +"to attach new methods to foreign types." msgstr "" -#: src/unsafe-deep-dive/setup.md -msgid "Setting Up" +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md +msgid "// Bring the extension trait into scope...\n" msgstr "" -#: src/unsafe-deep-dive/setup.md -#, fuzzy -msgid "Local Rust installation" -msgstr "Kurulum" +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md +msgid "// ...then invoke its methods as if they were inherent methods\n" +msgstr "" -#: src/unsafe-deep-dive/setup.md -msgid "" -"You should have a Rust compiler installed that supports the 2024 edition of " -"the language, which is any version of rustc higher than 1.84." +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/trait-method-conflicts.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "\"dad\"" msgstr "" -#: src/unsafe-deep-dive/setup.md -msgid "(Optional) Create a local instance of the course" +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md +msgid "\"grandma\"" msgstr "" -#: src/unsafe-deep-dive/setup.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md msgid "" -"```console\n" -"$ git clone --depth=1 https://github.com/google/comprehensive-rust.git\n" -"Cloning into 'comprehensive-rust'...\n" -"...\n" -"$ cd comprehensive-rust\n" -"$ cargo install-tools\n" -"...\n" -"$ cargo serve # then open http://127.0.0.1:3000/ in a browser\n" -"```" +"The `Ext` suffix is conventionally attached to the name of extension traits." msgstr "" -#: src/unsafe-deep-dive/setup.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md msgid "" -"Ask everyone to confirm that everyone is able to execute `rustc` with a " -"version older that 1.87." +"It communicates that the trait is primarily used for extension purposes, and " +"it is therefore not intended to be implemented outside the crate that " +"defines it." msgstr "" -#: src/unsafe-deep-dive/setup.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md msgid "" -"For those people who do not, tell them that we'll resolve that in the break." +"Refer to the [\"Extension Trait\" RFC](https://rust-lang.github.io/rfcs/0445-" +"extension-trait-conventions.html) as the authoritative source for naming " +"conventions." msgstr "" -#: src/unsafe-deep-dive/motivations.md -msgid "We know that writing code without the guarantees that Rust provides ..." +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md +msgid "" +"The extension trait implementation for a foreign type must be in the same " +"crate as the trait itself, otherwise you'll be blocked by Rust's [_orphan " +"rule_](https://github.com/rust-lang/rfcs/blob/master/text/2451-re-" +"rebalancing-coherence.md#what-is-coherence-and-why-do-we-care)." msgstr "" -#: src/unsafe-deep-dive/motivations.md -msgid "" -"“Use-after-free (UAF), integer overflows, and out of bounds (OOB) reads/" -"writes comprise 90% of vulnerabilities with OOB being the most common.”" +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md +msgid "The extension trait must be in scope when its methods are invoked." msgstr "" -#: src/unsafe-deep-dive/motivations.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md msgid "" -"\\--— **Jeff Vander Stoep and Chong Zang**, Google. \"[Queue the Hardening " -"Enhancements](https://security.googleblog.com/2019/05/queue-hardening-" -"enhancements.html)\"" +"Comment out the `use` statement in the example to show the compiler error " +"that's emitted if you try to invoke an extension method without having the " +"corresponding extension trait in scope." msgstr "" -#: src/unsafe-deep-dive/motivations.md -msgid "... so why is `unsafe` part of the language?" +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md +msgid "" +"The example above uses an [_underscore import_](https://doc.rust-lang.org/" +"stable/reference/items/use-declarations.html#r-items.use.as-underscore) " +"(`use ext::StringExt as _`) to minimize the likelihood of a naming conflict " +"with other imported traits." msgstr "" -#: src/unsafe-deep-dive/motivations.md -#, fuzzy -msgid "1 minute" -msgstr "15 dakika" - -#: src/unsafe-deep-dive/motivations.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md msgid "" -"The `unsafe` keyword exists because there is no compiler technology " -"available today that makes it obsolete. Compilers cannot verify everything." +"With an underscore import, the trait is considered to be in scope and you're " +"allowed to invoke its methods on types that implement the trait. Its " +"_symbol_, instead, is not directly accessible. This prevents you, for " +"example, from using that trait in a `where` clause." msgstr "" -#: src/unsafe-deep-dive/motivations/interop.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-foreign-types.md msgid "" -"TODO: Refactor this content into multiple slides as this slide is intended " -"as an introduction to the motivations only, rather than to be an elaborate " -"discussion of the whole problem." +"Since extension traits aren't meant to be used in `where` clauses, they are " +"conventionally imported via an underscore import." msgstr "" -#: src/unsafe-deep-dive/motivations/interop.md -msgid "Language interoperability allows you to:" +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"What happens when you have a name conflict between an inherent method and an " +"extension method?" msgstr "" -#: src/unsafe-deep-dive/motivations/interop.md -msgid "Call functions written in other languages from Rust" +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"// Which `count_ones` method is invoked?\n" +" // The one from `CountOnesExt`? Or the inherent one from `i32`?\n" msgstr "" -#: src/unsafe-deep-dive/motivations/interop.md -msgid "Write functions in Rust that are callable from other languages" +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"A foreign type may, in a newer version, add a new inherent method with the " +"same name as our extension method." msgstr "" -#: src/unsafe-deep-dive/motivations/interop.md -msgid "However, this requires unsafe." +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"Ask: What will happen in the example above? Will there be a compiler error? " +"Will one of the two methods be given higher priority? Which one?" msgstr "" -#: src/unsafe-deep-dive/motivations/interop.md -#, fuzzy -msgid "\"{a:?}\"" -msgstr "\"{:?}\"" - -#: src/unsafe-deep-dive/motivations/interop.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md msgid "" -"The Rust compiler can't enforce any safety guarantees for programs that it " -"hasn't compiled, so it delegates that responsibility to you through the " -"unsafe keyword." +"Add a `panic!(\"Extension trait\");` in the body of `CountOnesExt::" +"count_ones` to clarify which method is being invoked." msgstr "" -#: src/unsafe-deep-dive/motivations/interop.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md msgid "" -"The code example we're seeing shows how to call the random function provided " -"by libc within Rust. libc is available to scripts in the Rust Playground." +"To prevent users of the Rust language from having to manually specify which " +"method to use in all cases, there is a priority ordering system for how " +"methods get \"picked\" first:" msgstr "" -#: src/unsafe-deep-dive/motivations/interop.md -msgid "This uses Rust's _foreign function interface_." +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "Immutable (`&self`) first" msgstr "" -#: src/unsafe-deep-dive/motivations/interop.md +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"Inherent (method defined in the type's `impl` block) before Trait (method " +"added by a trait impl)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "Mutable (`&mut self`) Second" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "Inherent before Trait." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"If every method with the same name has different mutability and was either " +"defined in as an inherent method or trait method, with no overlap, this " +"makes the job easy for the compiler." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"This does introduce some ambiguity for the user, who may be confused as to " +"why a method they're relying on is not producing expected behavior. Avoid " +"name conflicts instead of relying on this mechanism if you can." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"Demonstrate: Change the signature and implementation of `CountOnesExt::" +"count_ones` to `fn count_ones(&mut self) -> u32` and modify the invocation " +"accordingly:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"`CountOnesExt::count_ones` is invoked, rather than the inherent method, " +"since `&mut self` has a higher priority than `&self`, the one used by the " +"inherent method." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"If an immutable inherent method and a mutable trait method exist for the " +"same type, we can specify which one to use at the call site by using " +"`(&).count_ones()` to get the immutable (higher priority) method or " +"`(&mut ).count_ones()`" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"Point the students to the Rust reference for more information on [method " +"resolution](https://doc.rust-lang.org/stable/reference/expressions/method-" +"call-expr.html)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"Avoid naming conflicts between extension trait methods and inherent methods. " +"Rust's method resolution algorithm is complex and may surprise users of your " +"code." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "More to explore" +msgstr "Daha fazlasını keşfedin" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/method-resolution-conflicts.md +msgid "" +"The interaction between the priority search used by Rust's method resolution " +"algorithm and automatic `Deref`ing can be used to emulate [specialization]" +"(https://github.com/rust-lang/rust/issues/31844) on the stable toolchain, " +"primarily in the context of macro-generated code. Check out [\"Autoref " +"Specialization\"](https://github.com/dtolnay/case-studies/blob/master/" +"autoref-specialization/README.md) for the specific details." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/trait-method-conflicts.md +msgid "" +"What happens when you have a name conflict between two different trait " +"methods implemented for the same type?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/trait-method-conflicts.md +msgid "" +"// Which method is invoked?\n" +"// The one from `Ext1`? Or the one from `Ext2`?\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/trait-method-conflicts.md +msgid "" +"The trait you are extending may, in a newer version, add a new trait method " +"with the same name as your extension method. Or another extension trait for " +"the same type may define a method with a name that conflicts with your own " +"extension method." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/trait-method-conflicts.md +msgid "" +"Ask: what will happen in the example above? Will there be a compiler error? " +"Will one of the two methods be given higher priority? Which one?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/trait-method-conflicts.md +msgid "" +"The compiler rejects the code because it cannot determine which method to " +"invoke. Neither `Ext1` nor `Ext2` has a higher priority than the other." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/trait-method-conflicts.md +msgid "To resolve this conflict, you must specify which trait you want to use." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/trait-method-conflicts.md +msgid "" +"Demonstrate: call `Ext1::is_palindrome(&\"dad\")` or `Ext2::" +"is_palindrome(&\"dad\")` instead of `\"dad\".is_palindrome()`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/trait-method-conflicts.md +msgid "" +"For methods with more complex signatures, you may need to use a more " +"explicit [fully-qualified syntax](https://doc.rust-lang.org/reference/" +"expressions/call-expr.html#disambiguating-function-calls)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/trait-method-conflicts.md +msgid "" +"Demonstrate: replace `\"dad\".is_palindrome()` with `<&str as Ext1>::" +"is_palindrome(&\"dad\")` or `<&str as Ext2>::is_palindrome(&\"dad\")`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"As with types, it may be desirable to **extend foreign traits**. In " +"particular, to attach new methods to _all_ implementors of a given trait." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "\"'{}'\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "\"'dad'\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "\"'4'\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "\"'true'\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"Highlight how we added new behavior to _multiple_ types at once. `.quoted()` " +"can be called on string slices, numbers, and booleans since they all " +"implement the `Display` trait." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"This flavor of the extension trait pattern uses [_blanket implementations_]" +"(https://doc.rust-lang.org/stable/reference/glossary.html#blanket-" +"implementation)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"A blanket implementation implements a trait for all types `T` that satisfy " +"the trait bounds specified in the `impl` block. In this case, the only " +"requirement is that `T` implements the `Display` trait." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"Draw the students' attention to the implementation of `DisplayExt::quoted`: " +"we can't make any assumptions about `T` other than that it implements " +"`Display`. All our logic must either use methods from `Display` or functions/" +"macros that don't require other traits." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"For example, we can call `format!` with `T`, but can't call `." +"to_uppercase()` because it is not necessarily a `String`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"We could introduce additional trait bounds on `T`, but it would restrict the " +"set of types that can leverage the extension trait." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"Conventionally, the extension trait is named after the trait it extends, " +"followed by the `Ext` suffix. In the example above, `DisplayExt`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"There are entire crates that extend standard library traits with new " +"functionality." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"`itertools` crate provides the `Itertools` trait that extends `Iterator`. It " +"adds many iterator adapters, such as `interleave` and `unique`. It provides " +"new algorithmic building blocks for iterator pipelines built with method " +"chaining." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"`futures` crate provides the `FutureExt` trait, which extends the `Future` " +"trait with new combinators and helper methods." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"Extension traits can be used by libraries to distinguish between stable and " +"experimental methods." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "Stable methods are part of the trait definition." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"Experimental methods are provided via an extension trait defined in a " +"different library, with a less restrictive stability policy. Some utility " +"methods are then \"promoted\" to the core trait definition once they have " +"been proven useful and their design has been refined." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"Extension traits can be used to split a [dyn-incompatible trait](https://doc." +"rust-lang.org/reference/items/traits.html#r-items.traits.dyn-compatible) in " +"two:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"A **dyn-compatible core**, restricted to the methods that satisfy dyn-" +"compatibility requirements." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"An **extension trait**, containing the remaining methods that are not dyn-" +"compatible (e.g., methods with a generic parameter)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/extending-other-traits.md +msgid "" +"Concrete types that implement the core trait will be able to invoke all " +"methods, thanks to the blanket impl for the extension trait. Trait objects " +"(`dyn CoreTrait`) will be able to invoke all methods on the core trait as " +"well as those on the extension trait that don't require `Self: Sized`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/should-i-define-an-extension-trait.md +msgid "" +"In what scenarios should you prefer an extension trait over a free function?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/should-i-define-an-extension-trait.md +msgid "// vs\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/should-i-define-an-extension-trait.md +msgid "The main advantage of extension traits is **ease of discovery**." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/should-i-define-an-extension-trait.md +msgid "" +"Extension methods can be easier to discover than free functions. Language " +"servers (e.g., `rust-analyzer`) will suggest them if you type `.` after an " +"instance of the foreign type." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/should-i-define-an-extension-trait.md +msgid "" +"However, a bespoke extension trait might be overkill for a single method. " +"Both approaches require an additional import, and the familiar method syntax " +"may not justify the boilerplate of a full trait definition." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/should-i-define-an-extension-trait.md +msgid "" +"**Discoverability:** Extension methods are easier to discover than free " +"functions. Language servers (e.g., `rust-analyzer`) will suggest them if you " +"type `.` after an instance of the foreign type." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/should-i-define-an-extension-trait.md +msgid "" +"**Method Chaining:** A major ergonomic win for extension traits is method " +"chaining. This is the foundation of the `Iterator` trait, allowing for " +"fluent calls like `data.iter().filter(...).map(...)`. Achieving this with " +"free functions would be far more cumbersome " +"(`map(filter(iter(data), ...), ...)`)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/should-i-define-an-extension-trait.md +msgid "" +"**API Cohesion:** Extension traits help create a cohesive API. If you have " +"several related functions for a foreign type (e.g., `is_palindrome`, " +"`word_count`, `to_kebab_case`), grouping them in a single `StrExt` trait is " +"often cleaner than having multiple free functions for a user to import." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/extension-traits/should-i-define-an-extension-trait.md +msgid "" +"**Trade-offs:** Despite these advantages, a bespoke extension trait might be " +"overkill for a single, simple function. Both approaches require an " +"additional import, and the familiar method syntax may not justify the " +"boilerplate of a full trait definition." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +msgid "Typestate Pattern: Problem" +msgstr "Tür Durum (Typestate) Deseni: Problem" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +msgid "" +"How can we ensure that only valid operations are allowed on a value based on " +"its current state?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/root.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/property.md +msgid "\"{name} {{\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "\" {key}={value};\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "\"}\\n\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "\"User\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "\"id\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "\"42\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "\"name\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +msgid "// serializer.serialize_struct_end(); // ← Oops! Forgotten\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +msgid "This `Serializer` is meant to write a structured value." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +msgid "" +"However, in this example we forgot to call `serialize_struct_end()` before " +"`finish()`. As a result, the serialized output is incomplete or " +"syntactically incorrect." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +msgid "" +"One approach to fix this would be to track internal state manually, and " +"return a `Result` from methods like `serialize_struct_field()` or `finish()` " +"if the current state is invalid." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +msgid "But this has downsides:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +msgid "" +"It is easy to get wrong as an implementer. Rust’s type system cannot help " +"enforce the correctness of our state transitions." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +msgid "" +"It also adds unnecessary burden on the user, who must handle `Result` values " +"for operations that are misused in source code rather than at runtime." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +msgid "" +"A better solution is to model the valid state transitions directly in the " +"type system." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern.md +msgid "" +"In the next slide, we will apply the **typestate pattern** to enforce " +"correct usage at compile time and make it impossible to call incompatible " +"methods or forget to do a required action." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "Typestate Pattern: Example" +msgstr "Tür Durum (Typestate) Deseni: Örnek" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "" +"The typestate pattern encodes part of a value’s runtime state into its type. " +"This allows us to prevent invalid or inapplicable operations at compile time." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "`Serializer` usage flowchart:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "" +"This example is inspired by Serde’s [`Serializer` trait](https://docs.rs/" +"serde/latest/serde/ser/trait.Serializer.html). Serde uses typestates " +"internally to ensure serialization follows a valid structure. For more, see: " +"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "" +"The key idea behind typestate is that state transitions happen by consuming " +"a value and producing a new one. At each step, only operations valid for " +"that state are available." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "In this example:" +msgstr "Bu örnekte:" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "" +"We begin with a `Serializer`, which only allows us to start serializing a " +"struct." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "" +"Once we call `.serialize_struct(...)`, ownership moves into a " +"`SerializeStruct` value. From that point on, we can only call methods " +"related to serializing struct fields." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "" +"The original `Serializer` is no longer accessible — preventing us from " +"mixing modes (such as starting another _struct_ mid-struct) or calling " +"`finish()` too early." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "" +"Only after calling `.finish_struct()` do we receive the `Serializer` back. " +"At that point, the output can be finalized or reused." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "" +"If we forget to call `finish_struct()` and drop the `SerializeStruct` early, " +"the `Serializer` is also dropped. This ensures incomplete output cannot leak " +"into the system." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-example.md +msgid "" +"By contrast, if we had implemented everything on `Serializer` directly — as " +"seen on the previous slide, nothing would stop someone from skipping " +"important steps or mixing serialization flows." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "" +"How do we manage increasingly complex configuration flows with many possible " +"states and transitions, while still preventing incompatible operations?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "/* [...] */" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "" +"// TODO, implement:\n" +" //\n" +" // fn serialize_struct(self, name: &str) -> SerializeStruct\n" +" // fn finish(self) -> String\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "" +"// TODO, implement:\n" +" //\n" +" // fn serialize_property(mut self, name: &str) -> " +"SerializeStructProperty\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "" +"// TODO,\n" +" // How should we finish this struct? This depends on where it appears:\n" +" // - At the root level: return `Serializer`\n" +" // - As a property inside another struct: return `SerializeStruct`\n" +" // - As a value inside a list: return `SerializeList`\n" +" //\n" +" // fn finish(self) -> ???\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "" +"// TODO, implement:\n" +" //\n" +" // fn serialize_string(self, value: &str) -> SerializeStruct\n" +" // fn serialize_struct(self, name: &str) -> SerializeStruct\n" +" // fn serialize_list(self) -> SerializeList\n" +" // fn finish(self) -> SerializeStruct\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "" +"// TODO, implement:\n" +" //\n" +" // fn serialize_string(mut self, value: &str) -> Self\n" +" // fn serialize_struct(mut self, value: &str) -> SerializeStruct\n" +" // fn serialize_list(mut self) -> SerializeList\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "" +"// TODO:\n" +" // Like `SerializeStruct::finish`, the return type depends on nesting.\n" +" //\n" +" // fn finish(mut self) -> ???\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics.md +msgid "Diagram of valid transitions:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "" +"Building on our previous serializer, we now want to support **nested " +"structures** and **lists**." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "" +"However, this introduces both **duplication** and **structural complexity**." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "" +"Even more critically, we now hit a **type system limitation**: we cannot " +"cleanly express what `finish()` should return without duplicating variants " +"for every nesting context (e.g. root, struct, list)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "From the diagram of valid transitions, we can observe:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "The transitions are recursive" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "The return types depend on _where_ a substructure or list appears" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "Each context requires a return path to its parent" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "" +"With only concrete types, this becomes unmanageable. Our current approach " +"leads to an explosion of types and manual wiring." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-advanced.md +msgid "" +"In the next chapter, we’ll see how **generics** let us model recursive flows " +"with less boilerplate, while still enforcing valid operations at compile " +"time." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics.md +msgid "" +"By combining typestate modeling with generics, we can express a wider range " +"of valid states and transitions without duplicating logic. This approach is " +"especially useful when the number of states grows or when multiple states " +"share behavior but differ in structure." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics.md +msgid "" +"We now have all the tools needed to implement the methods for the " +"`Serializer` and its state type definitions. This ensures that our API only " +"permits valid transitions, as illustrated in the following diagram:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics.md +msgid "" +"By leveraging generics to track the parent context, we can construct " +"arbitrarily nested serializers that enforce valid transitions between " +"struct, list, and property states." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics.md +msgid "" +"This enables us to build a recursive structure while maintaining strict " +"control over which methods are accessible in each state." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics.md +msgid "" +"Methods common to all states can be defined for any `S` in `Serializer`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics.md +msgid "" +"Marker types (e.g., `List`) introduce no memory or runtime overhead, as " +"they contain no data other than a possible Zero-Sized Type. Their only role " +"is to enforce correct API usage through the type system." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/root.md +msgid "" +"Referring back to our original diagram of valid transitions, we can " +"visualize the beginning of our implementation as follows:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/root.md +msgid "" +"At the \"root\" of our `Serializer`, the only construct allowed is a " +"`Struct`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/root.md +msgid "" +"The `Serializer` can only be finalized into a `String` from this root level." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/struct.md +msgid "\"{}{name}: \"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/struct.md +msgid "\"{}}}\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/struct.md +msgid "The diagram can now be expanded as follows:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/struct.md +msgid "A `Struct` can only contain a `Property`;" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/struct.md +msgid "" +"Finishing a `Struct` returns control back to its parent, which in our " +"previous slide was assumed the `Root`, but in reality however it can be also " +"something else such as `Struct` in case of nested \"structs\"." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/property.md +msgid "\"[\"" +msgstr "\"[\"" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/property.md +msgid "\"{value},\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/property.md +msgid "" +"With the addition of the Property state methods, our diagram is now nearly " +"complete:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/property.md +msgid "" +"A property can be defined as a `String`, `Struct`, or `List`, enabling " +"the representation of nested structures." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/property.md +msgid "" +"This concludes the step-by-step implementation. The full implementation, " +"including support for `List`, is shown in the next slide." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/complete.md +msgid "Serializer: complete implementation" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/complete.md +msgid "Looking back at our original desired flow:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/complete.md +msgid "We can now see this reflected directly in the types of our serializer:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/complete.md +msgid "" +"The code for the full implementation of the `Serializer` and all its states " +"can be found in [this Rust playground](https://play.rust-lang.org/?" +"version=stable&mode=debug&edition=2024&gist=c9cbb831cd05fe9db4ce42713c83ca16)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/complete.md +msgid "This pattern isn't a silver bullet. It still allows issues like:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/complete.md +msgid "" +"Empty or invalid property names (which can be fixed using [the newtype " +"pattern](../../newtype-pattern.md))" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/complete.md +msgid "" +"Duplicate property names (which could be tracked in `Struct` and handled " +"via `Result`)" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/complete.md +msgid "" +"If validation failures occur, we can also change method signatures to return " +"a `Result`, allowing recovery:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/complete.md +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-01-types.md +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "/* ... */" +msgstr "/* ... */" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/complete.md +msgid "" +"While this API is powerful, it’s not always ergonomic. Production " +"serializers typically favor simpler APIs and reserve the typestate pattern " +"for enforcing critical invariants." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics/complete.md +msgid "" +"One excellent real-world example is [`rustls::ClientConfig`](https://docs.rs/" +"rustls/latest/rustls/client/struct.ClientConfig.html#method.builder), which " +"uses typestate with generics to guide the user through safe and correct " +"configuration steps." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "Using the Borrow checker to enforce Invariants" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"The borrow checker, while added to enforce memory ownership, can model other " +"problems and prevent API misuse." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"/// Doors can be open or closed, and you need the right key to lock or " +"unlock\n" +"/// one. Modelled with a Shared key and Owned door.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "\"Opened the door with key shape '{}'\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "\"Door wasn't opened! Your key only opens locks with shape '{}'\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"We've seen the borrow checker prevent memory safety bugs (use-after-free, " +"data races)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"We've also used types to shape and restrict APIs already using [the " +"Typestate pattern](../leveraging-the-type-system/typestate-pattern.md)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "Language features are often introduced for a specific purpose." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"Over time, users may develop ways of using a feature in ways that were not " +"predicted when they were introduced." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"Java 5 introduced Generics in 2004 with the [main stated purpose of enabling " +"type-safe collections](https://jcp.org/en/jsr/detail?id=14)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"Adoption was slow at first, but some new projects began designing their APIs " +"around generics from the beginning." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"Since then, users and developers of the language expanded the use of " +"generics to other areas of type-safe API design:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"Class information can be held onto via Java's `Class` or Guava's " +"`TypeToken`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "The Builder pattern can be implemented using Recursive Generics." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"We aim to do something similar here: Even though the borrow checker was " +"introduced to prevent use-after-free and data races, we treat it as just " +"another API design tool." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"It can be used to model program properties that have nothing to do with " +"preventing memory safety bugs." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"To use the borrow checker as a problem solving tool, we will need to " +"\"forget\" that the original purpose of it is to prevent mutable aliasing in " +"the context of preventing use-after-frees and data races." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"We should imagine working within situations where the rules are the same but " +"the meaning is slightly different." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"This example uses ownership and borrowing are used to model the state of a " +"physical door." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"`open_door` **consumes** a `LockedDoor` and returns a new `OpenDoor`. The " +"old `LockedDoor` value is no longer available." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"If the wrong key is used, the door is left locked. It is returned as an " +"`Err` case of the `Result`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"It is a compile-time error to try and use a door that has already been " +"opened." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"Similarly, `lock_door` consumes an `OpenDoor`, preventing closing the door " +"twice at compile time." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"The rules of the borrow checker exist to prevent memory safety bugs, but the " +"underlying logical system does not \"know\" what memory is." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"All the borrow checker does is enforce a specific set of rules of how users " +"can order operations." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants.md +msgid "" +"This is just one case of piggy-backing onto the rules of the borrow checker " +"to design APIs to be harder or impossible to misuse." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "// An internal data type to have something to hold onto.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "// The \"outer\" data.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "// let exclusive = exclusive_use(&mut value); // ❌🔨\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "// let shared = shared_use(&value); // ❌🔨\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "" +"This example re-frames the borrow checker rules away from references and " +"towards semantic meaning in non-memory-safety settings." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "Nothing is being mutated, nothing is being sent across threads." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "" +"In rust's borrow checker we have access to three different ways of " +"\"taking\" a value:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "" +"Owned value `T`. Value is dropped when the scope ends, unless it is not " +"returned to another scope." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "" +"Shared Reference `&T`. Allows aliasing but prevents mutable access while " +"shared references are in use." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "" +"Mutable Reference `&mut T`. Only one of these is allowed to exist for a " +"value at any one point, but can be used to create shared references." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "" +"Ask: The two commented-out lines in the `demo` functions would cause " +"compilation errors, Why?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "" +"`demo_exclusive`: Because the `shared` value is still aliased after the " +"`exclusive` reference is taken." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "" +"`demo_denied`: Because `value` is consumed the line before the " +"`shared_again_again` reference is taken from `&value`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "" +"Remember that every `&T` and `&mut T` has a lifetime, just one the user " +"doesn't have to annotate or think about most of the time." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/generalizing-ownership.md +msgid "" +"We rarely specify lifetimes because the Rust compiler allows us to _elide_ " +"them in most cases. See: [Lifetime Elision](../../../lifetimes/lifetime-" +"elision.md)" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "" +"Sometimes we want values that _can only be used once_. One critical example " +"of this is in cryptography: A \"Nonce.\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "/* specifics omitted */" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "/// A single-use number suitable for cryptographic purposes.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "/// A cryptographically sound random generator function.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "// chosen by a fair dice roll, https://xkcd.com/221/\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "/// Consume a nonce, but not the key or the data.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "" +"// The key and data can be re-used, copied, etc. but the nonce cannot.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "// encrypt(nonce, &key, &data_2); // 🛠️❌\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "Problem: How can we guarantee a value is used only once?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "" +"Motivation: A nonce is a piece of random, unique data used in cryptographic " +"protocols to prevent replay attacks." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "" +"Background: In practice people have ended up accidentally re-using nonces. " +"Most commonly, this causes the cryptographic protocol to completely break " +"down and stop fulfilling its function." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "" +"Depending on the specifics of nonce reuse and cryptography at hand, private " +"keys can also become computable by attackers." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "" +"Rust has an obvious tool for achieving the invariant \"Once you use this, " +"you can't use it again\": passing a value as an _owned argument_." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "" +"Highlight: the `encrypt` function takes `nonce` by value (an owned " +"argument), but `key` and `data` by reference." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "The technique for single-use values is as follows:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "" +"Keep constructors private, so a user can't construct values with the same " +"inner value twice." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "" +"Don't implement `Clone`/`Copy` traits or equivalent methods, so a user can't " +"duplicate data we want to keep unique." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "" +"Make the interior type opaque (like with the newtype pattern), so the user " +"cannot modify an existing value on their own." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "Ask: What are we missing from the newtype pattern in the slide's code?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "Expect: Module boundary." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "" +"Demonstrate: Without a module boundary a user can construct a nonce on their " +"own." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "Fix: Put `Key`, `Nonce`, and `new_nonce` behind a module." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/single-use-values.md +msgid "" +"Cryptography Nuance: A nonce might still be used twice if it was created " +"through pseudo-random process with no actual randomness. That can't be " +"prevented through this method. This API design prevents one nonce " +"duplication, but not all logic bugs." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"We can use the mutual exclusion of `&T` and `&mut T` references to prevent " +"data from being used before it is ready." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "/* fields omitted */" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "// fake results\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "// Send the query over, but don't wait for results.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "// Finish executing the transaction and retrieve the results.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "// The transaction `tx` mutably borrows `db`.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "\"SELECT * FROM users\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"// This won't compile because `db` is already mutably borrowed by `tx`.\n" +" // let results = db.results(); // ❌🔨\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "// The borrow of `db` ends when `tx` is consumed by `commit()`.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "// Now it is possible to borrow `db` again.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"Motivation: In this database API queries are kicked off for asynchronous " +"execution and the results are only available once the whole transaction is " +"finished." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"A user might think that queries are executed immediately, and try to read " +"results before they are made available. This API misuse could make the app " +"read incomplete or incorrect data." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"While an obvious misunderstanding, situations such as this can happen in " +"practice." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"Ask: Has anyone misunderstood an API by not reading the docs for proper use?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"Expect: Examples of early-career or in-university mistakes and " +"misunderstandings." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"As an API grows in size and user base, a smaller percentage of users has " +"deep knowledge of the system the API represents." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"This example shows how we can use Aliasing XOR Mutability to prevent this " +"kind of misuse." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"The code might read results before they are ready if the programmer assumes " +"that the queries execute immediately rather than kicked off for asynchronous " +"execution." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"The constructor for the `Transaction` type takes a mutable reference to the " +"database connection, and stores it in the returned `Transaction` value." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"The explicit lifetime here doesn't have to be intimidating, it just means " +"\"`Transaction` is outlived by the `DatabaseConnection` that was passed to " +"it\" in this case." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"The reference is mutable to completely lock out the `DatabaseConnection` " +"from other usage, such as starting further transactions or reading the " +"results." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"While a `Transaction` exists, we can't touch the `DatabaseConnection` " +"variable that was created from it." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"Demonstrate: uncomment the `db.results()` line. Doing so will result in a " +"compile error, as `db` is already mutably borrowed." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"Note: The query results not being public and placed behind a getter function " +"lets us enforce the invariant \"users can only look at query results if " +"there is no active transactions.\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/aliasing-xor-mutability.md +msgid "" +"If the query results were placed in a public struct field, this invariant " +"could be violated." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-01-types.md +msgid "PhantomData 1/4: De-duplicating Same Data & Semantics" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-01-types.md +msgid "" +"The newtype pattern can sometimes come up against the DRY principle, how do " +"we solve this?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-01-types.md +msgid "// And so on ...\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-01-types.md +msgid "" +"Problem: We want to use the newtype pattern to differentiate permissions, " +"but we're having to implement the same traits over and over again for the " +"same data." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-01-types.md +msgid "" +"Ask: Assume the details of each implementation here are the same between " +"types, what are ways we can avoid repeating ourselves?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-01-types.md +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "Expect:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-01-types.md +msgid "Make this an enum, not distinct data types." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-01-types.md +msgid "" +"Bundle the user ID with permission tokens like `struct Admin(u64, " +"UserPermission, ModeratorPermission, AdminPermission);`" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-01-types.md +msgid "Adding a type parameter which encodes permissions." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-01-types.md +msgid "Mentioning `PhantomData` ahead of schedule (it's in the title)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "PhantomData 2/4: Type-level tagging" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "" +"Let's solve the problem from the previous slide by adding a type parameter." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "// use std::marker::PhantomData;\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "// Admins are users\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "" +"// impl Debug for UserTag {/* ... */}\n" +"// impl PartialEq for UserTag {/* ... */}\n" +"// impl Eq for UserTag {/* ... */}\n" +"// And so on ...\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "/* All functionality for users and above */" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "/* All functionality for only admins */" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "" +"Here we're using a type parameter and gating permissions behind \"tag\" " +"types that implement different permission traits." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "" +"Tag types, or marker types, are zero-sized types that have some semantic " +"meaning to users and API designers." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "" +"Ask: What issues does having it be an actual instance of that type pose?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "" +"Answer: If it's not a zero-sized type (like `()` or `struct MyTag;`), then " +"we're allocating more memory than we need to when all we care for is type " +"information that is only relevant at compile-time." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "Demonstrate: remove the `tag` value entirely, then compile!" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "This won't compile, as there's an unused (phantom) type parameter." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "This is where `PhantomData` comes in!" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "" +"Demonstrate: Uncomment the `PhantomData` import, and make `ChatId` the " +"following:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "" +"`PhantomData` is a zero-sized type with a type parameter. We can " +"construct values of it like other ZSTs with `let phantom: " +"PhantomData = PhantomData;` or with the `PhantomData::default()` " +"implementation." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "" +"Demonstrate: implement `From` for `ChatId`, emphasizing the " +"construction of `PhantomData`" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "// Or `PhantomData::default()`\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-02-types-implemented.md +msgid "" +"`PhantomData` can be used as part of the Typestate pattern to have data with " +"the same structure but different methods, e.g., have `TaggedData` " +"implement methods or trait implementations that `TaggedData` doesn't." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "PhantomData 3/4: Lifetimes for External Resources" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"The invariants of external resources often match what we can do with " +"lifetime rules." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"/// Direct FFI to a database library in C.\n" +"/// We got this API as is, we have no influence over it.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "// maximum 255 databases open at the same time\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "// ... etc.\n" +msgstr "// ... vb.\n" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"Remember the transaction API from the [Aliasing XOR Mutability](./aliasing-" +"xor-mutability.md) example." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"We held onto a mutable reference to the database connection within the " +"transaction type to lock out the database while a transaction is active." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"In this example, we want to implement a `Transaction` API on top of an " +"external, non-Rust API." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"We start by defining a `Transaction` type that holds onto `&mut " +"DatabaseConnection`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"Ask: What are the limits of this implementation? Assume the `u8` is accurate " +"implementation-wise and enough information for us to use the external API." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"Indirection takes up 7 bytes more than we need to on a 64-bit platform, as " +"well as costing a pointer dereference at runtime." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"Problem: We want the transaction to borrow the database connection that " +"created it, but we don't want the `Transaction` object to store a real " +"reference." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"Ask: What happens when we remove the mutable reference in `Transaction` " +"while keeping the lifetime parameter?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "Expect: Unused lifetime parameter!" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"Like with the type tagging from the previous slides, we can bring in " +"`PhantomData` to capture this unused lifetime parameter for us." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"The difference is that we will need to use the lifetime alongside another " +"type, but that other type does not matter too much." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "Demonstrate: change `Transaction` to the following:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "Update the `DatabaseConnection::new_transaction()` method:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"This gives an owned database connection that is tied to the " +"`DatabaseConnection` that created it, but with less runtime memory footprint " +"that the store-a-reference version did." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"Because `PhantomData` is a zero-sized type (like `()` or `struct " +"MyZeroSizedType;`), the size of `Transaction` is now the same as `u8`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"The implementation that held onto a reference instead was as large as a " +"`usize`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"This way of encoding relationships between types and values is very powerful " +"when combined with unsafe, as the ways one can manipulate lifetimes becomes " +"almost arbitrary. This is also dangerous, but when combined with tools like " +"external, mechanically-verified proofs we can safely encode cyclic/self-" +"referential types while encoding lifetime & safety expectations in the " +"relevant data types." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-03-lifetimes.md +msgid "" +"The [GhostCell (2021)](https://plv.mpi-sws.org/rustbelt/ghostcell/) paper " +"and its [relevant implementation](https://gitlab.mpi-sws.org/FP/ghostcell) " +"show this kind of work off. While the borrow checker is restrictive, there " +"are still ways to use escape hatches and then _show that the ways you used " +"those escape hatches are consistent and safe._" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "PhantomData 4/4: OwnedFd & BorrowedFd" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "`BorrowedFd` is a prime example of `PhantomData` in action." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "" +"// Create a file with a raw syscall with write-only and create permissions.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "\"c_str.txt\"" +msgstr "\"c_str.txt\"" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "" +"// Pass the ownership of an integer file descriptor to an `OwnedFd`.\n" +" // `OwnedFd::drop()` closes the file descriptor.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "\"Could not open file with syscall!\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "" +"// Create a `BorrowedFd` from an `OwnedFd`.\n" +" // `BorrowedFd::drop()` does not close the file because it doesn't own " +"it!\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "// std::mem::drop(owned_fd); // ❌🔨\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "// owned_fd will be dropped here, and the file will be closed.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "A file descriptor represents a specific process's access to a file." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "" +"Reminder: Device and OS-specific features are exposed as if they were files " +"on unix-style systems." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "" +"[`OwnedFd`](https://rust-lang.github.io/rfcs/3128-io-safety.html#ownedfd-and-" +"borrowedfdfd) is an owned wrapper type for a file descriptor. It _owns_ the " +"file descriptor, and closes it when dropped." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "" +"Note: We have our own implementation of it here, draw attention to the " +"explicit `Drop` implementation." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "" +"`BorrowedFd` is its borrowed counterpart, it does not need to close the file " +"when it is dropped." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "Note: We have not explicitly implemented `Drop` for `BorrowedFd`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "" +"`BorrowedFd` uses a lifetime captured with a `PhantomData` to enforce the " +"invariant \"if this file descriptor exists, the OS file descriptor is still " +"open even though it is not responsible for closing that file descriptor.\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "" +"The lifetime parameter of `BorrowedFd` demands that there exists another " +"value in your program that lasts as long as that specific `BorrowedFd` or " +"outlives it (in this case an `OwnedFd`)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "" +"Demonstrate: Uncomment the `std::mem::drop(owned_fd)` line and try to " +"compile to show that `borrowed_fd` relies on the lifetime of `owned_fd`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "" +"This has been encoded by the API designers to mean _that other value is what " +"keeps the access to the file open_." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/borrow-checker-invariants/phantomdata-04-borrowedfd.md +msgid "" +"Because Rust's borrow checker enforces this relationship where one value " +"must last at least as long as another, users of this API do not need to " +"worry about handling this correct file descriptor aliasing and closing logic " +"themselves." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "" +"Types with private constructors can be used to act as proof of invariants." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "// A public type with private fields behind a module boundary.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "\"We have a token, so we can make assumptions.\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "// We have a token, so we can do this work.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "// We could not get a token, so we can't call `protected_work`.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "" +"Motivation: We want to be able to restrict user's access to functionality " +"until they've performed a specific task." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "" +"We can do this by defining a type the API consumer cannot construct on their " +"own, through the privacy rules of structs and modules." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "" +"[Newtypes](./newtype-pattern.md) use the privacy rules in a similar way, to " +"restrict construction unless a value is guaranteed to hold up an invariant " +"at runtime." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "Ask: What is the purpose of the `proof: ()` field here?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "" +"Without `proof: ()`, `Token` would have no private fields and users would be " +"able to construct values of `Token` arbitrarily." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "" +"Demonstrate: Try to construct the token manually in `main` and show the " +"compilation error. Demonstrate: Remove the `proof` field from `Token` to " +"show how users would be able to construct `Token` if it had no private " +"fields." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "" +"By putting the `Token` type behind a module boundary (`token`), users " +"outside that module can't construct the value on their own as they don't " +"have permission to access the `proof` field." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "" +"The API developer gets to define methods and functions that produce these " +"tokens. The user does not." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "" +"The token becomes a proof that one has met the API developer's conditions of " +"access for those tokens." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "" +"Ask: How might an API developer accidentally introduce ways to circumvent " +"this?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types.md +msgid "" +"Expect answers like \"serialization implementations\", other parser/\"from " +"string\" implementations, or an implementation of `Default`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/permission-tokens.md +msgid "Token types work well as a proof of checked permission." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/permission-tokens.md +msgid "\"Password123\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/permission-tokens.md +msgid "" +"// We don't have to check that we have permissions, because\n" +"// the AdminToken argument is equivalent to such a check.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/permission-tokens.md +msgid "\"CoolUser\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/permission-tokens.md +msgid "\"Incorrect password! Could not prove privileges.\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/permission-tokens.md +msgid "" +"This example shows modelling gaining administrator privileges for a chat " +"client with a password and giving a user a moderator rank once those " +"privileges are gained. The `AdminToken` type acts as \"proof of correct user " +"privileges.\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/permission-tokens.md +msgid "" +"The user asked for a password in-code and if we get the password correct, we " +"get a `AdminToken` to perform administrator actions within a specific " +"environment (here, a chat client)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/permission-tokens.md +msgid "" +"Once the permissions are gained, we can call the `add_moderator` function." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/permission-tokens.md +msgid "" +"We can't call that function without the token type, so by being able to call " +"it at all all we can assume we have permissions." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/permission-tokens.md +msgid "" +"Demonstrate: Try to construct the `AdminToken` in `main` again to reiterate " +"that the foundation of useful tokens is preventing their arbitrary " +"construction." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/mutex-guard.md +msgid "" +"Sometimes, a token type needs additional data. A mutex guard is an example " +"of a token that represents permission + data." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/mutex-guard.md +msgid "// The acquired MutexGuard is proof of exclusive access.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/mutex-guard.md +msgid "" +"Mutexes enforce mutual exclusion of read/write access to a value. We've " +"covered Mutexes earlier in this course already (See: RAII/Mutex), but here " +"we're looking at `MutexGuard` specifically." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/mutex-guard.md +msgid "" +"`MutexGuard` is a value generated by a `Mutex` that proves you have read/" +"write access at that point in time." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/mutex-guard.md +msgid "" +"`MutexGuard` also holds onto a reference to the `Mutex` that generated it, " +"with `Deref` and `DerefMut` implementations that give access to the data of " +"`Mutex` while the underlying `Mutex` keeps that data private from the user." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/mutex-guard.md +msgid "" +"If `mutex.lock()` does not return a `MutexGuard`, you don't have permission " +"to change the value within the mutex." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/mutex-guard.md +msgid "" +"Not only do you have no permission, but you have no means to access the " +"mutex data unless you gain a `MutexGuard`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/mutex-guard.md +msgid "" +"This contrasts with C++, where mutexes and lock guards do not control access " +"to the data itself, acting only as a flag that a user must remember to check " +"every time they read or manipulate data." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/mutex-guard.md +msgid "" +"Demonstrate: make the `mutex` variable mutable then try to dereference it to " +"change its value. Show how there's no deref implementation for it, and no " +"other way to get to the data held by it other than getting a mutex guard." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "Variable-Specific Tokens (Branding 1/4)" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "What if we want to tie a token to a specific variable?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "// Works fine!\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "" +"// let data_2 = Bytes { bytes: vec![0, 1] };\n" +" // data_2.get_proven(&token_1); // Panics! Can we prevent this?\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "" +"What if we want to tie a token to a _specific variable_ in our code? Can we " +"do this in Rust's type system?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "" +"Motivation: We want to have a Token Type that represents a known, valid " +"index into a byte array." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "" +"Once we have these proven indexes we would be able to avoid bounds checks " +"entirely, as the tokens would act as the _proof of an existing index_." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "" +"Since the index is known to be valid, `get_proven()` can skip the bounds " +"check." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "" +"In this example there's nothing stopping the proven index of one array being " +"used on a different array. If an index is out of bounds in this case, it is " +"undefined behavior." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "Demonstrate: Uncomment the `data_2.get_proven(&token_1);` line." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "" +"The code here panics! We want to prevent this \"crossover\" of token types " +"for indexes at compile time." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "Ask: How might we try to do this?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "" +"Expect students to not reach a good implementation from this, but be willing " +"to experiment and follow through on suggestions." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "Ask: What are the alternatives, why are they not good enough?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "" +"Expect runtime checking of index bounds, especially as both `Vec::get` and " +"`Bytes::get_index` already uses runtime checking." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "" +"Runtime bounds checking does not prevent the erroneous crossover in the " +"first place, it only guarantees a panic." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "" +"The kind of token-association we will be doing here is called Branding. This " +"is an advanced technique that expands applicability of token types to more " +"API designs." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-01-motivation.md +msgid "" +"[`GhostCell`](https://plv.mpi-sws.org/rustbelt/ghostcell/paper.pdf) is a " +"prominent user of this, later slides will touch on it." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "`PhantomData` and Lifetime Subtyping (Branding 2/4)" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "Idea:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "Use a lifetime as a unique brand for each token." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Make lifetimes sufficiently distinct so that they don't implicitly convert " +"into each other." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "// The main focus\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "// We want this to NOT compile\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "In Rust, lifetimes can have subtyping relations between one another." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"This kind of relation allows the compiler to determine if one lifetime " +"outlives another." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Determining if a lifetime outlives another also allows us to say _the " +"shortest common lifetime is the one that ends first_." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"This is useful in many cases, as it means two different lifetimes can be " +"treated as if they were the same in the regions they do overlap." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"This is usually what we want. But here we want to use lifetimes as a way to " +"distinguish values so we say that a token only applies to a single variable " +"without having to create a newtype for every single variable we declare." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"**Goal**: We want two lifetimes that the rust compiler cannot determine if " +"one outlives the other." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"We are using `try_coerce_lifetimes` as a compile-time check to see if the " +"lifetimes have a common shorter lifetime (AKA being subtyped)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Note: This slide compiles, by the end of this slide it should only compile " +"when `subtyped_lifetimes` is commented out." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "There are two important parts of this code:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "The `impl for<'a>` bound on the closure passed to `lifetime_separator`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "The way lifetimes are used in the parameter for `PhantomData`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "`for<'a>` bound on a Closure" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"We are using `for<'a>` as a way of introducing a lifetime generic parameter " +"to a function type and asking that the body of the function to work for all " +"possible lifetimes." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"What this also does is remove some ability of the compiler to make " +"assumptions about that specific lifetime for the function argument, as it " +"must meet rust's borrow checking rules regardless of the \"real\" lifetime " +"its arguments are going to have. The caller is substituting in actual " +"lifetime, the function itself cannot." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"This is analogous to a forall (Ɐ) quantifier in mathematics, or the way we " +"introduce `` as type variables, but only for lifetimes in trait bounds." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"When we write a function generic over a type `T`, we can't determine that " +"type from within the function itself. Even if we call a function `fn foo(first: T, second: U)` with two arguments of the same type, the body of " +"this function cannot determine if `T` and `U` are the same type." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"This also prevents _the API consumer_ from defining a lifetime themselves, " +"which would allow them to circumvent the restrictions we want to impose." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "PhantomData and Lifetime Variance" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"We already know `PhantomData`, which can introduce a formal no-op usage of " +"an otherwise unused type or a lifetime parameter." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "Ask: What can we do with `PhantomData`?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Expect mentions of the Typestate pattern, tying together the lifetimes of " +"owned values." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "Ask: In other languages, what is subtyping?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Expect mentions of inheritance, being able to use a value of type `B` when a " +"asked for a value of type `A` because `B` is a \"subtype\" of `A`." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "Rust does have Subtyping! But only for lifetimes." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Ask: If one lifetime is a subtype of another lifetime, what might that mean?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"A lifetime is a \"subtype\" of another lifetime when it _outlives_ that " +"other lifetime." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"The way that lifetimes used by `PhantomData` behave depends not only on " +"where the lifetime \"comes from\" but on how the reference is defined too." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"The reason this compiles is that the [**Variance**](https://doc.rust-lang." +"org/stable/reference/subtyping.html#r-subtyping.variance) of the lifetime " +"inside of `InvariantLifetime` is too lenient." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Note: Do not expect to get students to understand variance entirely here, " +"just treat it as a kind of ladder of restrictiveness on the ability of " +"lifetimes to establish subtyping relations." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Ask: How can we make it more restrictive? How do we make a reference type " +"more restrictive in rust?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Expect or demonstrate: Making it `&'id mut ()` instead. This will not be " +"enough!" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"We need to use a [**Variance**](https://doc.rust-lang.org/stable/reference/" +"subtyping.html#r-subtyping.variance) on lifetimes where subtyping cannot be " +"inferred except on _identical lifetimes_. That is, the only subtype of `'a` " +"the compiler can know is `'a` itself." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Note: Again, do not try to get the whole class to understand variance. Treat " +"it as a ladder of restrictiveness for now." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Demonstrate: Move from `&'id ()` (covariant in lifetime and type), `&'id mut " +"()` (covariant in lifetime, invariant in type), `*mut &'id mut ()` " +"(invariant in lifetime and type), and finally `*mut &'id ()` (invariant in " +"lifetime but not type)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Those last two should not compile, which means we've finally found " +"candidates for how to bind lifetimes to `PhantomData` so they can't be " +"compared to one another in this context." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Reason: `*mut` means [mutable raw pointer](https://doc.rust-lang.org/" +"reference/types/pointer.html#r-type.pointer.raw). Rust has mutable pointers! " +"But you cannot reason about them in safe rust. Making this a mutable raw " +"pointer to a reference that has a lifetime complicates the compiler's " +"ability subtype because it cannot reason about mutable raw pointers within " +"the borrow checker." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"Wrap up: We've introduced ways to stop the compiler from deciding that " +"lifetimes are \"similar enough\" by choosing a Variance for a lifetime in " +"`PhantomData` that is restrictive enough to prevent this slide from " +"compiling." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"That is, we can now create variables that can exist in the same scope as " +"each other, but whose types are automatically made different from one " +"another per-variable without much boilerplate." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-02-phantomdata.md +msgid "" +"The `for<'a>` quantifier is not just for function types. It is a [**Higher-" +"ranked trait bound**](https://doc.rust-lang.org/reference/subtyping.html?" +"search=Hiher#r-subtype.higher-ranked)." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "Implementing Branded Types (Branding 3/4)" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "" +"Constructing branded types is different to how we construct non-branded " +"types." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "// The data we want to modify in this context.\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "// The function that uniquely brands the lifetime of a `Bytes`\n" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "" +"Motivation: We want to have \"proven indexes\" for a type, and we don't want " +"those indexes to be usable by different variables of the same type. We also " +"don't want those indexes to escape a scope." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "Our Branded Type will be `Bytes`: a byte array." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "Our Branded Token will be `ProvenIndex`: an index known to be in range." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "There are several notable parts to this implementation:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "" +"`new` does not return a `Bytes`, instead asking for \"starting data\" and a " +"use-once Closure that is passed a `Bytes` when it is called." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "That `new` function has a `for<'a>` on its trait bound." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "" +"We have both a getter for an index and a getter for a values with a proven " +"index." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "Ask: Why does `new` not return a `Bytes`?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "" +"Answer: Because we need `Bytes` to have a unique lifetime controlled by the " +"API." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "" +"Ask: So what if `new()` returned `Bytes`, what is the specific harm that it " +"would cause?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "Answer: Think about the signature of that hypothetical `new()` method:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "`fn new<'a>() -> Bytes<'a> { ... }`" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "" +"This would allow the API user to choose what the lifetime `'a` is, removing " +"our ability to guarantee that the lifetimes between different instances of " +"`Bytes` are unique and unable to be subtyped to one another." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "Ask: Why do we need both a `get_index` and a `get_proven`?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "" +"Expect \"Because we can't know if an index is occupied at compile time\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "Ask: Then what's the point of the proven indexes?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "" +"Answer: Avoiding bounds checking while keeping knowledge of what indexes are " +"occupied specific to individual variables, unable to erroneously be used on " +"the wrong one." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-03-impl.md +msgid "" +"Note: The focus is not on only on avoiding overuse of bounds checks, but " +"also on preventing that \"cross over\" of indexes." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "Branded Types in Action (Branding 4/4)" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "" +"// bytes_2.get_proven(&index_1); // ❌🔨\n" +" \"Computations done!\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "\"{result}\"" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "" +"We now have the implementation ready, we can now write a program where token " +"types that are proofs of existing indexes cannot be shared between variables." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "" +"Demonstration: Uncomment the `bytes_2.get_proven(&index_1);` line and show " +"that it does not compile when we use indexes from different variables." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "" +"Ask: What operations can we perform that we can guarantee would produce a " +"proven index?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "Expect a \"push\" implementation, suggested demo:" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "" +"Ask: Can we make this not just about a byte array, but as a general wrapper " +"on `Vec`?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "Trivial: Yes!" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "Maybe demonstrate: Generalising `Bytes<'id>` into `BrandedVec<'id, T>`" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "Ask: What other areas could we use something like this?" +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "" +"The resulting token API is **highly restrictive**, but the things that it " +"makes possible to prove as safe within the Rust type system are meaningful." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "" +"[GhostCell](https://plv.mpi-sws.org/rustbelt/ghostcell/paper.pdf), a " +"structure that allows for safe cyclic data structures in Rust (among other " +"previously difficult to represent data structures), uses this kind of token " +"type to make sure cells can't \"escape\" a context where we know where " +"operations similar to those shown in these examples are safe." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "" +"This \"Branded Types\" sequence of slides is based off their `BrandedVec` " +"implementation in the paper, which covers many of the implementation details " +"of this use case in more depth as a gentle introduction to how `GhostCell` " +"itself is implemented and used in practice." +msgstr "" + +#: src/idiomatic/leveraging-the-type-system/token-types/branded-04-in-action.md +msgid "" +"GhostCell also uses formal checks outside of Rust's type system to prove " +"that the things it allows within this kind of context (lifetime branding) " +"are safe." +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "Welcome to Unsafe Rust" +msgstr "Emniyetsiz Rust'a Hoş Geldiniz" + +#: src/unsafe-deep-dive/welcome.md +msgid "IMPORTANT: THIS MODULE IS IN AN EARLY STAGE OF DEVELOPMENT" +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "" +"Please do not consider this module of Comprehensive Rust to be complete. " +"With that in mind, your feedback, comments, and especially your concerns, " +"are very welcome." +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "" +"To comment on this module's development, please use the [GitHub issue " +"tracker](https://github.com/google/comprehensive-rust/issues)." +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "" +"The `unsafe` keyword is easy to type, but hard to master. When used " +"appropriately, it forms a useful and indeed essential part of the Rust " +"programming language." +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "" +"By the end of this deep dive, you'll know how to work with `unsafe` code, " +"review others' changes that include the `unsafe` keyword, and produce your " +"own." +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "What you'll learn:" +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "What the terms undefined behavior, soundness, and safety mean" +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "Why the `unsafe` keyword exists in the Rust language" +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "How to write your own code using `unsafe` safely" +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "How to review `unsafe` code" +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "Links to other sections of the course" +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "The `unsafe` keyword has treatment in:" +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "" +"_Rust Fundamentals_, the main module of Comprehensive Rust, includes a " +"session on [Unsafe Rust](../unsafe-rust.html) in its last day." +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "" +"_Rust in Chromium_ discusses how to [interoperate with C++](../chromium/" +"interoperability-with-cpp.md). Consult that material if you are looking into " +"FFI." +msgstr "" + +#: src/unsafe-deep-dive/welcome.md +msgid "" +"_Bare Metal Rust_ uses unsafe heavily to interact with the underlying host, " +"among other things." +msgstr "" + +#: src/unsafe-deep-dive/setup.md +msgid "Setting Up" +msgstr "" + +#: src/unsafe-deep-dive/setup.md +msgid "Local Rust installation" +msgstr "" + +#: src/unsafe-deep-dive/setup.md +msgid "" +"You should have a Rust compiler installed that supports the 2024 edition of " +"the language, which is any version of rustc higher than 1.84." +msgstr "" + +#: src/unsafe-deep-dive/setup.md +msgid "(Optional) Create a local instance of the course" +msgstr "" + +#: src/unsafe-deep-dive/setup.md +msgid "" +"```console\n" +"$ git clone --depth=1 https://github.com/google/comprehensive-rust.git\n" +"Cloning into 'comprehensive-rust'...\n" +"...\n" +"$ cd comprehensive-rust\n" +"$ cargo install-tools\n" +"...\n" +"$ cargo serve # then open http://127.0.0.1:3000/ in a browser\n" +"```" +msgstr "" + +#: src/unsafe-deep-dive/setup.md +msgid "" +"Ask everyone to confirm that everyone is able to execute `rustc` with a " +"version older that 1.87." +msgstr "" + +#: src/unsafe-deep-dive/setup.md +msgid "" +"For those people who do not, tell them that we'll resolve that in the break." +msgstr "" + +#: src/unsafe-deep-dive/motivations.md +msgid "We know that writing code without the guarantees that Rust provides ..." +msgstr "" + +#: src/unsafe-deep-dive/motivations.md +msgid "" +"“Use-after-free (UAF), integer overflows, and out of bounds (OOB) reads/" +"writes comprise 90% of vulnerabilities with OOB being the most common.”" +msgstr "" + +#: src/unsafe-deep-dive/motivations.md +msgid "" +"\\--— **Jeff Vander Stoep and Chong Zang**, Google. \"[Queue the Hardening " +"Enhancements](https://security.googleblog.com/2019/05/queue-hardening-" +"enhancements.html)\"" +msgstr "" + +#: src/unsafe-deep-dive/motivations.md +msgid "... so why is `unsafe` part of the language?" +msgstr "" + +#: src/unsafe-deep-dive/motivations.md +msgid "1 minute" +msgstr "1 dakika" + +#: src/unsafe-deep-dive/motivations.md +msgid "" +"The `unsafe` keyword exists because there is no compiler technology " +"available today that makes it obsolete. Compilers cannot verify everything." +msgstr "" + +#: src/unsafe-deep-dive/motivations/interop.md +msgid "" +"TODO: Refactor this content into multiple slides as this slide is intended " +"as an introduction to the motivations only, rather than to be an elaborate " +"discussion of the whole problem." +msgstr "" + +#: src/unsafe-deep-dive/motivations/interop.md +msgid "Language interoperability allows you to:" +msgstr "" + +#: src/unsafe-deep-dive/motivations/interop.md +msgid "Call functions written in other languages from Rust" +msgstr "" + +#: src/unsafe-deep-dive/motivations/interop.md +msgid "Write functions in Rust that are callable from other languages" +msgstr "" + +#: src/unsafe-deep-dive/motivations/interop.md +msgid "However, this requires unsafe." +msgstr "" + +#: src/unsafe-deep-dive/motivations/interop.md +msgid "\"{a:?}\"" +msgstr "\"{a:?}\"" + +#: src/unsafe-deep-dive/motivations/interop.md +msgid "" +"The Rust compiler can't enforce any safety guarantees for programs that it " +"hasn't compiled, so it delegates that responsibility to you through the " +"unsafe keyword." +msgstr "" + +#: src/unsafe-deep-dive/motivations/interop.md +msgid "" +"The code example we're seeing shows how to call the random function provided " +"by libc within Rust. libc is available to scripts in the Rust Playground." +msgstr "" + +#: src/unsafe-deep-dive/motivations/interop.md +msgid "This uses Rust's _foreign function interface_." +msgstr "" + +#: src/unsafe-deep-dive/motivations/interop.md msgid "" "This isn't the only style of interoperability, however it is the method " "that's needed if you want to work between Rust and some other language in a " @@ -22542,9 +26095,8 @@ msgid "" msgstr "" #: src/unsafe-deep-dive/motivations/interop.md -#, fuzzy msgid "Consideration: type safety" -msgstr "entegrasyon testi:" +msgstr "" #: src/unsafe-deep-dive/motivations/interop.md msgid "" @@ -22616,14 +26168,12 @@ msgid "" msgstr "" #: src/unsafe-deep-dive/motivations/interop.md -#, fuzzy msgid "\"now (1): {}\"" -msgstr "\"u16 olarak: {}\"" +msgstr "" #: src/unsafe-deep-dive/motivations/interop.md -#, fuzzy msgid "\"future: {}\"" -msgstr "\"beş: {}\"" +msgstr "" #: src/unsafe-deep-dive/motivations/interop.md msgid "\"now (2): {}\"" @@ -22659,23 +26209,20 @@ msgid "" msgstr "" #: src/unsafe-deep-dive/motivations/interop.md -#, fuzzy msgid "b\"Hello, C\\0\"" -msgstr "\"Merhaba \"" +msgstr "b\"Merhaba, C\\0\"" #: src/unsafe-deep-dive/motivations/interop.md -#, fuzzy msgid "b\"Hello, Rust\"" -msgstr "\"Rust dilinden merhaba!\"" +msgstr "b\"Merhaba, Rust\"" #: src/unsafe-deep-dive/motivations/interop.md msgid "\"{c}\"" msgstr "" #: src/unsafe-deep-dive/motivations/interop.md -#, fuzzy msgid "\"{rust}\"" -msgstr "\"rust\"" +msgstr "\"{rust}\"" #: src/unsafe-deep-dive/motivations/data-structures.md msgid "Some families of data structures are impossible to create in safe Rust." @@ -22694,9 +26241,8 @@ msgid "self-referential types" msgstr "" #: src/unsafe-deep-dive/motivations/data-structures.md -#, fuzzy msgid "intrusive data structures" -msgstr "Veri Yapılarında Ömürler" +msgstr "" #: src/unsafe-deep-dive/motivations/data-structures.md msgid "" @@ -22738,10 +26284,13 @@ msgstr "" msgid "Some fundamental concepts and terms." msgstr "" +#: src/unsafe-deep-dive/foundations.md +msgid "This segment should take about 25 minutes. It contains:" +msgstr "Bu bölüm yaklaşık 25 dakika sürmelidir. İçeriği:" + #: src/unsafe-deep-dive/foundations/what-is-unsafe.md -#, fuzzy msgid "What is “unsafety”?" -msgstr "Rust Nedir?" +msgstr "" #: src/unsafe-deep-dive/foundations/what-is-unsafe.md msgid "Unsafe Rust is a superset of Safe Rust." @@ -22765,28 +26314,24 @@ msgid "" msgstr "" #: src/unsafe-deep-dive/foundations/what-is-unsafe.md -#, fuzzy msgid "..." -msgstr "// ...\n" +msgstr "..." #: src/unsafe-deep-dive/foundations/what-is-unsafe.md msgid "Here are the abilities Unsafe Rust has in addition to Safe Rust:" msgstr "" #: src/unsafe-deep-dive/foundations/what-is-unsafe.md -#, fuzzy msgid "Dereference raw pointers" -msgstr "Ham Göstericilerinin İçeriği (Dereferencing)" +msgstr "Bir ham göstericinin (raw pointer) içeriğine eriş (dereference)" #: src/unsafe-deep-dive/foundations/what-is-unsafe.md -#, fuzzy msgid "Implement unsafe traits" -msgstr "Emniyetsiz Özelliklerin (Unsafe Traits) Gerçekleştirilmesi" +msgstr "Emniyetsiz özelliklerin (unsafe traits) gerçekleştirilmesi" #: src/unsafe-deep-dive/foundations/what-is-unsafe.md -#, fuzzy msgid "Call unsafe functions" -msgstr "Emniyetsiz (Unsafe) Fonksiyonları Çağırma" +msgstr "Emniyetsiz (Unsafe) fonksiyonları çağırma" #: src/unsafe-deep-dive/foundations/what-is-unsafe.md msgid "Mutate statics (including external ones)" @@ -22797,11 +26342,8 @@ msgid "Access fields of unions" msgstr "" #: src/unsafe-deep-dive/foundations/what-is-unsafe.md -#, fuzzy msgid "From the [reference](https://doc.rust-lang.org/reference/unsafety.html)" msgstr "" -"[Rust Referansına](https://doc.rust-lang.org/reference/type-layout.html) " -"bakın." #: src/unsafe-deep-dive/foundations/what-is-unsafe.md msgid "" @@ -22810,9 +26352,8 @@ msgid "" msgstr "" #: src/unsafe-deep-dive/foundations/what-is-unsafe.md -#, fuzzy msgid "Dereferencing a raw pointer." -msgstr "Ham Göstericilerinin İçeriği (Dereferencing)" +msgstr "Bir ham göstericinin (raw pointer) içeriğine erişmek (dereferencing)." #: src/unsafe-deep-dive/foundations/what-is-unsafe.md msgid "Reading or writing a mutable or external static variable." @@ -22835,23 +26376,20 @@ msgid "" msgstr "" #: src/unsafe-deep-dive/foundations/what-is-unsafe.md -#, fuzzy msgid "Implementing an unsafe trait." -msgstr "Emniyetsiz Özelliklerin (Unsafe Traits) Gerçekleştirilmesi" +msgstr "Bir emniyetsiz özelliğin (unsafe trait) gerçekleştirilmesi." #: src/unsafe-deep-dive/foundations/what-is-unsafe.md -#, fuzzy msgid "Declaring an extern block." -msgstr "\"Sonraki bloktan çıkılıyor\"" +msgstr "" #: src/unsafe-deep-dive/foundations/what-is-unsafe.md msgid "Applying an unsafe attribute to an item." msgstr "" #: src/unsafe-deep-dive/foundations/what-is-unsafe.md -#, fuzzy msgid "Group exercise" -msgstr "Alıştırmalar hakkında" +msgstr "" #: src/unsafe-deep-dive/foundations/what-is-unsafe.md msgid "" @@ -22964,18 +26502,14 @@ msgid "" msgstr "" #: src/unsafe-deep-dive/foundations/when-is-unsafe-used.md -#, fuzzy msgid "Further references" -msgstr "Paylaşılan (Shared) Referanslar" +msgstr "" #: src/unsafe-deep-dive/foundations/when-is-unsafe-used.md -#, fuzzy msgid "" "[The unsafe keyword chapter of the Rust Reference](https://doc.rust-lang.org/" "reference/unsafe-keyword.html)" msgstr "" -"[Rust Referansına](https://doc.rust-lang.org/reference/type-layout.html) " -"bakın." #: src/unsafe-deep-dive/foundations/when-is-unsafe-used.md msgid "Places where pre-conditions can be defined (Role 1)" @@ -22990,15 +26524,11 @@ msgid "" msgstr "" #: src/unsafe-deep-dive/foundations/when-is-unsafe-used.md -#, fuzzy msgid "" "unsafe traits (`unsafe trait`). Examples: [`Send`](https://doc.rust-lang.org/" "std/marker/trait.Send.html) and [`Sync`](https://doc.rust-lang.org/std/" "marker/trait.Sync.html) marker traits in the standard library." msgstr "" -"[`Read`](https://doc.rust-lang.org/std/io/trait.Read.html) ve [`BufRead`]" -"(https://doc.rust-lang.org/std/io/trait.BufRead.html) kullanarak, `u8` " -"kaynakları üzerinde soyutlama yapabilirsiniz:" #: src/unsafe-deep-dive/foundations/when-is-unsafe-used.md msgid "Places where pre-conditions must be satisfied (Role 2)" @@ -23009,9 +26539,9 @@ msgid "unsafe blocks (`unafe { ... }`)" msgstr "" #: src/unsafe-deep-dive/foundations/when-is-unsafe-used.md -#, fuzzy msgid "implementing unsafe traits (`unsafe impl`)" -msgstr "Emniyetsiz Özelliklerin (Unsafe Traits) Gerçekleştirilmesi" +msgstr "" +"emniyetsiz özelliklerin (unsafe traits / `unsafe impl`) gerçekleştirilmesi" #: src/unsafe-deep-dive/foundations/when-is-unsafe-used.md msgid "access external items (`unsafe extern`)" @@ -23139,8 +26669,9 @@ msgstr "" #: src/glossary.md msgid "" -"argument: \n" -"Information that is passed into a function or method." +"array: \n" +"A fixed-size collection of elements of the same type, stored contiguously in " +"memory. See [Arrays](tuples-and-arrays/arrays.md)." msgstr "" #: src/glossary.md @@ -23172,26 +26703,15 @@ msgstr "" #: src/glossary.md msgid "" "borrow checker: \n" -"The part of the Rust compiler which checks that all borrows are valid." +"The part of the Rust compiler which checks that all [borrows](borrowing/" +"borrowck.md) are valid." msgstr "" #: src/glossary.md msgid "" "brace: \n" -"`{` and `}`. Also called _curly brace_, they delimit _blocks_." -msgstr "" - -#: src/glossary.md -msgid "" -"build: \n" -"The process of converting source code into executable code or a usable " -"program." -msgstr "" - -#: src/glossary.md -msgid "" -"call: \n" -"To invoke or execute a function or method." +"`{` and `}`. Also called _curly brace_, they delimit [_blocks_](control-flow-" +"basics/blocks-and-scopes.md)." msgstr "" #: src/glossary.md @@ -23200,194 +26720,177 @@ msgid "" "Used to safely pass messages [between threads](concurrency/channels.md)." msgstr "" -#: src/glossary.md -msgid "" -"Comprehensive Rust 🦀: \n" -"The courses here are jointly called Comprehensive Rust 🦀." -msgstr "" - #: src/glossary.md msgid "" "concurrency: \n" -"The execution of multiple tasks or processes at the same time." -msgstr "" - -#: src/glossary.md -msgid "" -"Concurrency in Rust: \n" -"See [Concurrency in Rust](concurrency/welcome.md)." +"The execution of multiple tasks or processes at the same time. See [Welcome " +"to Concurrency in Rust](concurrency/welcome.md)." msgstr "" #: src/glossary.md msgid "" "constant: \n" -"A value that does not change during the execution of a program." +"A value that does not change during the execution of a program. See [const]" +"(user-defined-types/const.md)." msgstr "" #: src/glossary.md msgid "" "control flow: \n" "The order in which the individual statements or instructions are executed in " -"a program." +"a program. See [Control Flow Basics](control-flow-basics.md)." msgstr "" #: src/glossary.md msgid "" "crash: \n" -"An unexpected and unhandled failure or termination of a program." +"An unexpected and unhandled failure or termination of a program. See [panic]" +"(error-handling/panics.md)." msgstr "" #: src/glossary.md msgid "" "enumeration: \n" "A data type that holds one of several named constants, possibly with an " -"associated tuple or struct." +"associated tuple or struct. See [enum](user-defined-types/enums.md)." msgstr "" #: src/glossary.md msgid "" "error: \n" -"An unexpected condition or result that deviates from the expected behavior." +"An unexpected condition or result that deviates from the expected behavior. " +"See [Error Handling](error-handling.md)." msgstr "" #: src/glossary.md msgid "" "error handling: \n" -"The process of managing and responding to errors that occur during program " -"execution." -msgstr "" - -#: src/glossary.md -msgid "" -"exercise: \n" -"A task or problem designed to practice and test programming skills." +"The process of managing and responding to [errors](error-handling.md) that " +"occur during program execution." msgstr "" #: src/glossary.md msgid "" "function: \n" -"A reusable block of code that performs a specific task." +"A reusable block of code that performs a specific task. See [Functions]" +"(control-flow-basics/functions.md)." msgstr "" #: src/glossary.md msgid "" "garbage collector: \n" "A mechanism that automatically frees up memory occupied by objects that are " -"no longer in use." +"no longer in use. See [Approaches to Memory Management](memory-management/" +"approaches.md)." msgstr "" #: src/glossary.md msgid "" "generics: \n" "A feature that allows writing code with placeholders for types, enabling " -"code reuse with different data types." +"code reuse with different data types. See [Generics](generics.md)." msgstr "" #: src/glossary.md msgid "" "immutable: \n" -"Unable to be changed after creation." +"Unable to be changed after creation. See [Variables](types-and-values/" +"variables.md)." msgstr "" #: src/glossary.md msgid "" "integration test: \n" "A type of test that verifies the interactions between different parts or " -"components of a system." -msgstr "" - -#: src/glossary.md -msgid "" -"keyword: \n" -"A reserved word in a programming language that has a specific meaning and " -"cannot be used as an identifier." +"components of a system. See [Other Types of Tests](testing/other.md)." msgstr "" #: src/glossary.md msgid "" "library: \n" -"A collection of precompiled routines or code that can be used by programs." +"A collection of precompiled routines or code that can be used by programs. " +"See [Modules](modules.md)." msgstr "" #: src/glossary.md msgid "" "macro: \n" -"Rust macros can be recognized by a `!` in the name. Macros are used when " -"normal functions are not enough. A typical example is `format!`, which takes " -"a variable number of arguments, which isn't supported by Rust functions." +"Rust [macros](control-flow-basics/macros.md) can be recognized by a `!` in " +"the name. Macros are used when normal functions are not enough. A typical " +"example is `format!`, which takes a variable number of arguments, which " +"isn't supported by Rust functions." msgstr "" #: src/glossary.md msgid "" "`main` function: \n" -"Rust programs start executing with the `main` function." +"Rust programs start executing with the [`main` function](types-and-values/" +"hello-world.md)." msgstr "" #: src/glossary.md msgid "" "match: \n" -"A control flow construct in Rust that allows for pattern matching on the " -"value of an expression." +"A control flow construct in Rust that allows for [pattern matching](pattern-" +"matching.md) on the value of an expression." msgstr "" #: src/glossary.md msgid "" "memory leak: \n" "A situation where a program fails to release memory that is no longer " -"needed, leading to a gradual increase in memory usage." +"needed, leading to a gradual increase in memory usage. See [Approaches to " +"Memory Management](memory-management/approaches.md)." msgstr "" #: src/glossary.md msgid "" "method: \n" -"A function associated with an object or a type in Rust." +"A function associated with an object or a type in Rust. See [Methods]" +"(methods-and-traits/methods.md)." msgstr "" #: src/glossary.md msgid "" "module: \n" "A namespace that contains definitions, such as functions, types, or traits, " -"to organize code in Rust." +"to organize code in Rust. See [Modules](modules.md)." msgstr "" #: src/glossary.md msgid "" "move: \n" -"The transfer of ownership of a value from one variable to another in Rust." +"The transfer of ownership of a value from one variable to another in Rust. " +"See [Move Semantics](memory-management/move.md)." msgstr "" #: src/glossary.md msgid "" "mutable: \n" -"A property in Rust that allows variables to be modified after they have been " -"declared." +"A property in Rust that allows [variables](types-and-values/variables.md) to " +"be modified after they have been declared." msgstr "" #: src/glossary.md msgid "" "ownership: \n" "The concept in Rust that defines which part of the code is responsible for " -"managing the memory associated with a value." +"managing the memory associated with a value. See [Ownership](memory-" +"management/ownership.md)." msgstr "" #: src/glossary.md msgid "" "panic: \n" "An unrecoverable error condition in Rust that results in the termination of " -"the program." -msgstr "" - -#: src/glossary.md -msgid "" -"parameter: \n" -"A value that is passed into a function or method when it is called." +"the program. See [Panics](error-handling/panics.md)." msgstr "" #: src/glossary.md msgid "" "pattern: \n" "A combination of values, literals, or structures that can be matched against " -"an expression in Rust." +"an expression in Rust. See [Pattern Matching](pattern-matching.md)." msgstr "" #: src/glossary.md @@ -23398,181 +26901,167 @@ msgstr "" #: src/glossary.md msgid "" -"program: \n" -"A set of instructions that a computer can execute to perform a specific task " -"or solve a particular problem." -msgstr "" - -#: src/glossary.md -msgid "" -"programming language: \n" -"A formal system used to communicate instructions to a computer, such as Rust." +"receiver: \n" +"The first parameter in a Rust [method](methods-and-traits/methods.md) that " +"represents the instance on which the method is called." msgstr "" #: src/glossary.md msgid "" -"receiver: \n" -"The first parameter in a Rust method that represents the instance on which " -"the method is called." +"reference: \n" +"A non-owning pointer to a value that borrows it without transferring " +"ownership. References can be [shared (immutable)](references/shared.md) or " +"[exclusive (mutable)](references/exclusive.md)." msgstr "" #: src/glossary.md msgid "" "reference counting: \n" "A memory management technique in which the number of references to an object " -"is tracked, and the object is deallocated when the count reaches zero." -msgstr "" - -#: src/glossary.md -msgid "" -"return: \n" -"A keyword in Rust used to indicate the value to be returned from a function." +"is tracked, and the object is deallocated when the count reaches zero. See " +"[Rc](smart-pointers/rc.md)." msgstr "" #: src/glossary.md msgid "" "Rust: \n" "A systems programming language that focuses on safety, performance, and " -"concurrency." -msgstr "" - -#: src/glossary.md -msgid "" -"Rust Fundamentals: \n" -"Days 1 to 4 of this course." -msgstr "" - -#: src/glossary.md -msgid "" -"Rust in Android: \n" -"See [Rust in Android](android.md)." +"concurrency. See [What is Rust?](hello-world/what-is-rust.md)." msgstr "" #: src/glossary.md msgid "" -"Rust in Chromium: \n" -"See [Rust in Chromium](chromium.md)." +"safe: \n" +"Refers to code that adheres to Rust's ownership and borrowing rules, " +"preventing memory-related errors. See [Unsafe Rust](unsafe-rust.md)." msgstr "" #: src/glossary.md msgid "" -"safe: \n" -"Refers to code that adheres to Rust's ownership and borrowing rules, " -"preventing memory-related errors." +"slice: \n" +"A dynamically-sized view into a contiguous sequence, such as an array or " +"vector. Unlike arrays, slices have a size determined at runtime. See [Slices]" +"(references/slices.md)." msgstr "" #: src/glossary.md msgid "" "scope: \n" -"The region of a program where a variable is valid and can be used." +"The region of a program where a variable is valid and can be used. See " +"[Blocks and Scopes](control-flow-basics/blocks-and-scopes.md)." msgstr "" #: src/glossary.md msgid "" "standard library: \n" -"A collection of modules providing essential functionality in Rust." +"A collection of modules providing essential functionality in Rust. See " +"[Standard Library](std-types/std.md)." msgstr "" #: src/glossary.md msgid "" "static: \n" "A keyword in Rust used to define static variables or items with a `'static` " -"lifetime." +"lifetime. See [static](user-defined-types/static.md)." msgstr "" #: src/glossary.md msgid "" "string: \n" -"A data type storing textual data. See [Strings](references/strings.html) for " -"more." +"A data type storing textual data. See [Strings](references/strings.md)." msgstr "" #: src/glossary.md msgid "" "struct: \n" "A composite data type in Rust that groups together variables of different " -"types under a single name." +"types under a single name. See [Structs](user-defined-types/named-structs." +"md)." msgstr "" #: src/glossary.md msgid "" "test: \n" -"A Rust module containing functions that test the correctness of other " -"functions." +"A function that tests the correctness of other code. Rust has a built-in " +"test runner. See [Testing](testing.md)." msgstr "" #: src/glossary.md msgid "" "thread: \n" -"A separate sequence of execution in a program, allowing concurrent execution." +"A separate sequence of execution in a program, allowing concurrent " +"execution. See [Threads](concurrency/threads.md)." msgstr "" #: src/glossary.md msgid "" "thread safety: \n" "The property of a program that ensures correct behavior in a multithreaded " -"environment." +"environment. See [Send and Sync](concurrency/send-sync.md)." msgstr "" #: src/glossary.md msgid "" "trait: \n" "A collection of methods defined for an unknown type, providing a way to " -"achieve polymorphism in Rust." +"achieve polymorphism in Rust. See [Traits](methods-and-traits/traits.md)." msgstr "" #: src/glossary.md msgid "" "trait bound: \n" "An abstraction where you can require types to implement some traits of your " -"interest." +"interest. See [Trait Bounds](generics/trait-bounds.md)." msgstr "" #: src/glossary.md msgid "" "tuple: \n" "A composite data type that contains variables of different types. Tuple " -"fields have no names, and are accessed by their ordinal numbers." +"fields have no names, and are accessed by their ordinal numbers. See [Tuples]" +"(tuples-and-arrays/tuples.md)." msgstr "" #: src/glossary.md msgid "" "type: \n" "A classification that specifies which operations can be performed on values " -"of a particular kind in Rust." +"of a particular kind in Rust. See [Types and Values](types-and-values.md)." msgstr "" #: src/glossary.md msgid "" "type inference: \n" "The ability of the Rust compiler to deduce the type of a variable or " -"expression." +"expression. See [Type Inference](types-and-values/inference.md)." msgstr "" #: src/glossary.md msgid "" "undefined behavior: \n" "Actions or conditions in Rust that have no specified result, often leading " -"to unpredictable program behavior." +"to unpredictable program behavior. See [Unsafe Rust](unsafe-rust.md)." msgstr "" #: src/glossary.md msgid "" "union: \n" -"A data type that can hold values of different types but only one at a time." +"A data type that can hold values of different types but only one at a time. " +"See [Unions](unsafe-rust/unions.md)." msgstr "" #: src/glossary.md msgid "" "unit test: \n" "Rust comes with built-in support for running small unit tests and larger " -"integration tests. See [Unit Tests](testing/unit-tests.html)." +"integration tests. See [Unit Tests](testing/unit-tests.md)." msgstr "" #: src/glossary.md msgid "" "unit type: \n" -"Type that holds no data, written as a tuple with no members." +"Type that holds no data, written as a tuple with no members. See speaker " +"notes on [Functions](control-flow-basics/functions.html)." msgstr "" #: src/glossary.md @@ -23585,7 +27074,8 @@ msgstr "" #: src/glossary.md msgid "" "variable: \n" -"A memory location storing data. Variables are valid in a _scope_." +"A memory location storing data. Variables are valid in a _scope_. See " +"[Variables](types-and-values/variables.md)." msgstr "" #: src/other-resources.md @@ -23730,6 +27220,12 @@ msgid "" "rules, through implementing a few different types of list structures." msgstr "" +#: src/other-resources.md +msgid "" +"[The Little Book of Rust Macros](https://danielkeep.github.io/tlborm/): " +"covers many details on Rust macros with practical examples." +msgstr "" + #: src/other-resources.md msgid "" "Please see the [Little Book of Rust Books](https://lborb.github.io/book/) " @@ -23784,6 +27280,49 @@ msgid "" "directory for details, including the license terms." msgstr "" +#~ msgid "Lifetime Annotations" +#~ msgstr "Ömür için Ek Açıklamalar (Annotations)" + +#~ msgid "Day 2 Morning (2 hours and 45 minutes, including breaks)" +#~ msgstr "2. Gün Sabah (2 saat 45 dakika, aralar dahil)" + +#~ msgid "Day 3 Afternoon (1 hour and 55 minutes, including breaks)" +#~ msgstr "3. Gün Öğleden Sonra (1 saat 55 dakika, aralar dahil)" + +#~ msgid "Rust has hygienic macros, `println!` is an example of this." +#~ msgstr "" +#~ "Rust arınmış/pak/izole (hygienic) makrolara sahiptir, `println!` buna bir " +#~ "örnektir." + +#~ msgid "" +#~ "Macros being 'hygienic' means they don't accidentally capture identifiers " +#~ "from the scope they are used in. Rust macros are actually only [partially " +#~ "hygienic](https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene." +#~ "html)." +#~ msgstr "" +#~ "Makroların 'arınmış/pak' olması, kullanıldıkları kapsamdaki (scope) " +#~ "tanımlayıcıları (identifiers) yanlışlıkla yakalamadıkları anlamına gelir. " +#~ "Rust makroları aslında yalnızca [kısmi paktır (hygienic)](https://veykril." +#~ "github.io/tlborm/decl-macros/minutiae/hygiene.html)." + +#~ msgid "`..` can expand as much as it needs to be" +#~ msgstr "`..` gerektiği kadar genişleyebilir" + +#~ msgid "" +#~ "Including 10 minute breaks, this session should take about 1 hour and 55 " +#~ "minutes. It contains:" +#~ msgstr "" +#~ "Bu oturum 10 dakikalık aralar dahil yaklaşık 1 saat 55 dakika sürmelidir. " +#~ "İçeriği:" + +#, fuzzy +#~ msgid "" +#~ "Including 10 minute breaks, this session should take about 25 minutes. It " +#~ "contains:" +#~ msgstr "" +#~ "Bu oturum 10 dakikalık aralar dahil yaklaşık 2 saat 45 dakika sürmelidir. " +#~ "İçeriği:" + #~ msgid "" #~ "On Debian/Ubuntu, you can also install Cargo, the Rust source and the " #~ "[Rust formatter](https://github.com/rust-lang/rustfmt) via `apt`. " @@ -23839,7 +27378,7 @@ msgstr "" #~ msgid "Pattern matching: destructuring enums, structs, and arrays." #~ msgstr "" #~ "Desen eşleştirme: numaralandırmaların (enums), yapıların ve dizilerin " -#~ "çözümlenmesi (destructuring)." +#~ "ayrıştırılması (destructuring)." #~ msgid "\"Final x: {x}\"" #~ msgstr "\"Son x: {x}\"" @@ -23949,9 +27488,6 @@ msgstr "" #~ msgid "\"matrix: {:#?}\"" #~ msgstr "\"matrix: {:#?}\"" -#~ msgid "\"transposed: {:#?}\"" -#~ msgstr "\"transposed: {:#?}\"" - #~ msgid "Rust will statically forbid dangling references:" #~ msgstr "" #~ "Rust, boşa düşen referansları (dangling references) statik olarak " @@ -23995,9 +27531,6 @@ msgstr "" #~ msgid "FromIterator" #~ msgstr "FromIterator" -#~ msgid "Writing Unsafe Functions" -#~ msgstr "Emniyetsiz (Unsafe) Fonksiyonlar Yazma" - #~ msgid "Slices: `&[T]`" #~ msgstr "Dilimler: `&[T]`" @@ -24110,9 +27643,6 @@ msgstr "" #~ msgid "[Control Flow Basics](./control-flow-basics.md) (40 minutes)" #~ msgstr "[Kontrol Akışı Temelleri](./control-flow-basics.md) (40 dakika)" -#~ msgid "In this segment:" -#~ msgstr "Bu bölümde:" - #~ msgid "[What is Rust?](./hello-world/what-is-rust.md) (10 minutes)" #~ msgstr "[Rust Nedir?](./hello-world/what-is-rust.md) (10 dakika)" @@ -24287,7 +27817,8 @@ msgstr "" #~ msgstr "[Paylaşılan Referanslar](./references/shared.md) (10 dakika)" #~ msgid "[Exclusive References](./references/exclusive.md) (10 minutes)" -#~ msgstr "[Özel Referanslar](./references/exclusive.md) (10 dakika)" +#~ msgstr "" +#~ "[Dışlayan (Exclusive) Referanslar](./references/exclusive.md) (10 dakika)" #~ msgid "[Slices: &\\[T\\]](./references/slices.md) (10 minutes)" #~ msgstr "[Dilimler: &\\[T\\]](../references/slices.md) (10 dakika)" @@ -24540,7 +28071,7 @@ msgstr "" #~ msgstr "while let İfadeleri" #~ msgid "Destructuring Arrays" -#~ msgstr "Dizilerin Çözümlenmesi" +#~ msgstr "Dizileri Ayrıştırma" #~ msgid "Match Guards" #~ msgstr "Eşleşme Koşulları/Filtreleri" @@ -24581,9 +28112,6 @@ msgstr "" #~ msgid "Field Shorthand Syntax" #~ msgstr "Alanlara İlk Değer Verme Kısaltması'nın Sözdizimi (Syntax)" -#~ msgid "Storing Books" -#~ msgstr "Kitapların Saklanması" - #~ msgid "Option and Result" #~ msgstr "Option ve Result"