1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-20 22:36:03 +02:00

[fa] Day 2 morning (#2266)

This commit is contained in:
Alix 2024-08-06 13:35:38 +03:30 committed by GitHub
parent 697df5599e
commit d297db97fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

276
po/fa.po
View File

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Comprehensive Rust 🦀\n" "Project-Id-Version: Comprehensive Rust 🦀\n"
"POT-Creation-Date: 2024-07-24T09:42:45+03:30\n" "POT-Creation-Date: 2024-07-24T09:42:45+03:30\n"
"PO-Revision-Date: 2024-07-24 10:12+0330\n" "PO-Revision-Date: 2024-08-05 19:35+0330\n"
"Last-Translator: alix1383 <dev.alix13@gmail.com>\n" "Last-Translator: alix1383 <dev.alix13@gmail.com>\n"
"Language-Team: Persian\n" "Language-Team: Persian\n"
"Language: fa\n" "Language: fa\n"
@ -243,7 +243,7 @@ msgstr "ساختار‌ تاپل‌ها"
#: src/SUMMARY.md src/user-defined-types.md src/user-defined-types/enums.md:1 #: src/SUMMARY.md src/user-defined-types.md src/user-defined-types/enums.md:1
#: src/pattern-matching/destructuring-enums.md:1 #: src/pattern-matching/destructuring-enums.md:1
msgid "Enums" msgid "Enums"
msgstr "" msgstr "Enums"
#: src/SUMMARY.md src/user-defined-types.md #: src/SUMMARY.md src/user-defined-types.md
msgid "Static" msgid "Static"
@ -264,7 +264,7 @@ msgstr "تمرین: رویدادهای آسانسور"
#: src/SUMMARY.md #: src/SUMMARY.md
msgid "Day 2: Morning" msgid "Day 2: Morning"
msgstr "روز دوم: صبح" msgstr "روز ۲: صبح"
#: src/SUMMARY.md src/running-the-course/course-structure.md:35 #: src/SUMMARY.md src/running-the-course/course-structure.md:35
#: src/welcome-day-2.md src/pattern-matching.md #: src/welcome-day-2.md src/pattern-matching.md
@ -304,28 +304,28 @@ msgstr "متدها"
#: src/SUMMARY.md src/methods-and-traits.md src/methods-and-traits/traits.md:1 #: src/SUMMARY.md src/methods-and-traits.md src/methods-and-traits/traits.md:1
msgid "Traits" msgid "Traits"
msgstr "صفت‌ها" msgstr "Traits"
#: src/SUMMARY.md src/methods-and-traits/traits/implementing.md:1 #: src/SUMMARY.md src/methods-and-traits/traits/implementing.md:1
msgid "Implementing Traits" msgid "Implementing Traits"
msgstr "پیاده سازی صفات (Traits)" msgstr "پیاده سازی Traits"
#: src/SUMMARY.md src/methods-and-traits/traits/supertraits.md:1 #: src/SUMMARY.md src/methods-and-traits/traits/supertraits.md:1
msgid "Supertraits" msgid "Supertraits"
msgstr "" msgstr "Supertraits"
#: src/SUMMARY.md src/methods-and-traits/traits/associated-types.md:1 #: src/SUMMARY.md src/methods-and-traits/traits/associated-types.md:1
msgid "Associated Types" msgid "Associated Types"
msgstr "" msgstr "تایپ‌های وابسته"
#: src/SUMMARY.md src/methods-and-traits.md #: src/SUMMARY.md src/methods-and-traits.md
#: src/methods-and-traits/deriving.md:1 #: src/methods-and-traits/deriving.md:1
msgid "Deriving" msgid "Deriving"
msgstr "" msgstr "Deriving"
#: src/SUMMARY.md src/methods-and-traits.md #: src/SUMMARY.md src/methods-and-traits.md
msgid "Exercise: Generic Logger" msgid "Exercise: Generic Logger"
msgstr "تمرین: توابع جنریک" msgstr "تمرین: توابع Generic"
#: src/SUMMARY.md #: src/SUMMARY.md
msgid "Day 2: Afternoon" msgid "Day 2: Afternoon"
@ -334,7 +334,7 @@ msgstr "روز دوم: عصر"
#: src/SUMMARY.md src/running-the-course/course-structure.md:43 #: src/SUMMARY.md src/running-the-course/course-structure.md:43
#: src/welcome-day-2-afternoon.md src/generics.md #: src/welcome-day-2-afternoon.md src/generics.md
msgid "Generics" msgid "Generics"
msgstr "جنریک‌ها" msgstr "Generics"
#: src/SUMMARY.md src/generics.md src/generics/generic-functions.md:1 #: src/SUMMARY.md src/generics.md src/generics/generic-functions.md:1
msgid "Generic Functions" msgid "Generic Functions"
@ -345,9 +345,8 @@ msgid "Generic Data Types"
msgstr "انواع داده‌ها جنریک (Generic Data Types)" msgstr "انواع داده‌ها جنریک (Generic Data Types)"
#: src/SUMMARY.md src/generics/generic-traits.md:1 #: src/SUMMARY.md src/generics/generic-traits.md:1
#, fuzzy
msgid "Generic Traits" msgid "Generic Traits"
msgstr "صفت‌های جنریک‌ها" msgstr "Generic Traits"
#: src/SUMMARY.md src/generics.md src/generics/trait-bounds.md:1 #: src/SUMMARY.md src/generics.md src/generics/trait-bounds.md:1
msgid "Trait Bounds" msgid "Trait Bounds"
@ -4534,7 +4533,7 @@ msgstr ""
#: src/user-defined-types.md src/methods-and-traits.md src/lifetimes.md #: src/user-defined-types.md src/methods-and-traits.md src/lifetimes.md
msgid "This segment should take about 50 minutes. It contains:" msgid "This segment should take about 50 minutes. It contains:"
msgstr "" msgstr "این بخش حدود ۵۰ دقیقه طول خواهد کشید. شامل موارد زیر است:"
#: src/user-defined-types/named-structs.md:3 #: src/user-defined-types/named-structs.md:3
msgid "Like C and C++, Rust has support for custom structs:" msgid "Like C and C++, Rust has support for custom structs:"
@ -5042,64 +5041,62 @@ msgstr ""
#: src/welcome-day-2.md #: src/welcome-day-2.md
msgid "Welcome to Day 2" msgid "Welcome to Day 2"
msgstr "به روز دوم خوش آمدید" msgstr "به روز ۲ خوش آمدید"
#: src/welcome-day-2.md #: src/welcome-day-2.md
#, fuzzy
msgid "" msgid ""
"Now that we have seen a fair amount of Rust, today will focus on Rust's type " "Now that we have seen a fair amount of Rust, today will focus on Rust's type "
"system:" "system:"
msgstr "" msgstr ""
"حالا که از زبان راست به اندازه کافی چیز های مختلفی دیده ایم وقت ادامه با " "اکنون که مقدار زیادی از Rust را دیده ایم، امروز بر روی سیستم تایپ Rust تمرکز "
"توجه به موارد زیر " "خواهیم کرد:"
#: src/welcome-day-2.md #: src/welcome-day-2.md
#, fuzzy
msgid "Pattern matching: extracting data from structures." msgid "Pattern matching: extracting data from structures."
msgstr "تطابق الگو: تجزیه و تحلیل enums, structs و آرایه‌ها." msgstr "تطبیق الگو: استخراج داده از ساختارها."
#: src/welcome-day-2.md #: src/welcome-day-2.md
msgid "Methods: associating functions with types." msgid "Methods: associating functions with types."
msgstr "" msgstr "متد‌ها: ارتباط توابع با تایپ ها."
#: src/welcome-day-2.md #: src/welcome-day-2.md
msgid "Traits: behaviors shared by multiple types." msgid "Traits: behaviors shared by multiple types."
msgstr "" msgstr "Traits: رفتارهایی که توسط چندین تایپ مشترک هستند."
#: src/welcome-day-2.md #: src/welcome-day-2.md
msgid "Generics: parameterizing types on other types." msgid "Generics: parameterizing types on other types."
msgstr "" msgstr "Generics: پارامتری‌سازی تایپ‌ها بر اساس تایپ‌های دیگر."
#: src/welcome-day-2.md #: src/welcome-day-2.md
msgid "" msgid ""
"Standard library types and traits: a tour of Rust's rich standard library." "Standard library types and traits: a tour of Rust's rich standard library."
msgstr "" msgstr ""
"کتابخانه‌استاندارد تایپ‌ها و traits: یک گردش در کتابخانه‌استاندارد و غنی Rust"
#: src/welcome-day-2.md #: src/welcome-day-2.md
msgid "" msgid ""
"Including 10 minute breaks, this session should take about 2 hours and 10 " "Including 10 minute breaks, this session should take about 2 hours and 10 "
"minutes. It contains:" "minutes. It contains:"
msgstr "" msgstr ""
"با احتساب ۱۰ دقیقه استراحت، این جلسه باید حدود ۲ ساعت و ۱۰ دقیقه طول بکشد. "
"این شامل:"
#: src/pattern-matching.md src/std-types.md src/memory-management.md #: src/pattern-matching.md src/std-types.md src/memory-management.md
#: src/error-handling.md #: src/error-handling.md
msgid "This segment should take about 1 hour. It contains:" msgid "This segment should take about 1 hour. It contains:"
msgstr "" msgstr "این بخش باید حدود ۱ ساعت طول بکشد. این شامل:"
#: src/pattern-matching/match.md:3 #: src/pattern-matching/match.md:3
msgid "" msgid ""
"The `match` keyword lets you match a value against one or more _patterns_. " "The `match` keyword lets you match a value against one or more _patterns_. "
"The comparisons are done from top to bottom and the first match wins." "The comparisons are done from top to bottom and the first match wins."
msgstr "" msgstr ""
"کلمه کلیدی `match` به شما امکان می دهد یک مقدار را در برابر _یک یا چند الگو_ " "کلمه کلیدی `match` به شما اجازه می‌دهد یک مقدار را با یک یا چند _الگو_ مطابقت "
"مطابقت دهید. مقایسه‌ها از بالا به پایین انجام می‌شوند و اولین تطبیق انتخاب " "دهید. مقایسه‌ها از بالا به پایین انجام می‌شوند و اولین تطابق انتخاب می‌شود."
"می‌شود."
#: src/pattern-matching/match.md:6 #: src/pattern-matching/match.md:6
msgid "The patterns can be simple values, similarly to `switch` in C and C++:" msgid "The patterns can be simple values, similarly to `switch` in C and C++:"
msgstr "" msgstr "الگوها می توانند مقادیر ساده ای باشند، شبیه به `switch` در C و ++C:"
"الگوها می توانند مقادیر ساده ای باشند، شبیه به `switch` در C و <span "
"dir=ltr>C++</span>:"
#: src/pattern-matching/match.md:11 #: src/pattern-matching/match.md:11
msgid "'x'" msgid "'x'"
@ -5168,27 +5165,33 @@ msgid ""
"expressions _must_ be exhaustive, meaning that it covers every possibility, " "expressions _must_ be exhaustive, meaning that it covers every possibility, "
"so `_` is often used as the final catch-all case." "so `_` is often used as the final catch-all case."
msgstr "" msgstr ""
"الگوی `_` یک الگوی عام (Wildcard) است که با هر مقداری مطابقت دارد. عبارت‌ها "
"باید جامع باشند، به این معنی که همه احتمالات را پوشش دهند، بنابراین `_` اغلب "
"به عنوان آخرین حالت برای پوشش تمامی موارد استفاده می‌شود."
#: src/pattern-matching/match.md:26 #: src/pattern-matching/match.md:26
#, fuzzy
msgid "" msgid ""
"Match can be used as an expression. Just like `if`, each match arm must have " "Match can be used as an expression. Just like `if`, each match arm must have "
"the same type. The type is the last expression of the block, if any. In the " "the same type. The type is the last expression of the block, if any. In the "
"example above, the type is `()`." "example above, the type is `()`."
msgstr "" msgstr ""
"مثل دستور `if let`، باید همه شاخه تطبیق باید از نوع یکسانی را داشته باشند. " "`match` می‌تواند به عنوان یک عبارت استفاده شود. دقیقاً مانند `if`، هر شاخه "
"نوع عبارت در آخر بلوک تعیین می‌شود، البته اگر وجود داشته باشد. در مثال بالا، " "match باید از یک تایپ باشد. تایپ بازگشتی، تایپ آخرین عبارت در بلاک است، اگر "
"نوع `()` است." "وجود داشته باشد. در مثال بالا، تایپ بازگشتی `()` است."
#: src/pattern-matching/match.md:30 #: src/pattern-matching/match.md:30
msgid "" msgid ""
"A variable in the pattern (`key` in this example) will create a binding that " "A variable in the pattern (`key` in this example) will create a binding that "
"can be used within the match arm." "can be used within the match arm."
msgstr "" msgstr ""
"یک متغیر در الگو (`key` در این مثال) یک اتصال ایجاد می‌کند که می‌توان از آن در "
"بخش مطابقت استفاده کرد."
#: src/pattern-matching/match.md:33 #: src/pattern-matching/match.md:33
msgid "A match guard causes the arm to match only if the condition is true." msgid "A match guard causes the arm to match only if the condition is true."
msgstr "" msgstr ""
"یک guard در عبارت `match` باعث می‌شود که آن شاخه تنها در صورتی مطابقت داشته "
"باشد که شرط برقرار باشد."
#: src/pattern-matching/match.md:40 #: src/pattern-matching/match.md:40
msgid "" msgid ""
@ -5208,12 +5211,11 @@ msgstr "`..` برای تعیین همه محدوده یا تا جایی که م
#: src/pattern-matching/match.md:44 #: src/pattern-matching/match.md:44
msgid "`1..=5` represents an inclusive range" msgid "`1..=5` represents an inclusive range"
msgstr "" msgstr ""
"<span dir=ltr><code class=hljs>1..=5</code></span> نمایانگر یک محدوده خاص " "<span dir=ltr><code class=hljs>1..=5</code></span> نمایانگر یک محدوده خاص است"
"است."
#: src/pattern-matching/match.md:45 #: src/pattern-matching/match.md:45
msgid "`_` is a wild card" msgid "`_` is a wild card"
msgstr "`_` یک wildcard (هر حالتی) است." msgstr "`_` نمایانگر هر حالتی است"
#: src/pattern-matching/match.md:47 #: src/pattern-matching/match.md:47
msgid "" msgid ""
@ -5221,7 +5223,7 @@ msgid ""
"we wish to concisely express more complex ideas than patterns alone would " "we wish to concisely express more complex ideas than patterns alone would "
"allow." "allow."
msgstr "" msgstr ""
"گارد های تطبیق به عنوان یک ویژگی سینتکس جداگانه دسته بندی می‌شوند, زمانی مهم " "guard های تطبیق به عنوان یک ویژگی سینتکس جداگانه دسته بندی می‌شوند, زمانی مهم "
"و ضروری هستند که بخواهیم ایده های پیچیده تر از الگوهای ساده بیان کنیم." "و ضروری هستند که بخواهیم ایده های پیچیده تر از الگوهای ساده بیان کنیم."
#: src/pattern-matching/match.md:49 #: src/pattern-matching/match.md:49
@ -5233,7 +5235,7 @@ msgid ""
msgstr "" msgstr ""
"آنها با عبارت `if` جداگانه ای در داخل یک شاخه تطبیق هستند یکسان نیستند. یک " "آنها با عبارت `if` جداگانه ای در داخل یک شاخه تطبیق هستند یکسان نیستند. یک "
"عبارت `if` در داخل بلاک شاخه (پس از <span dir=ltr>`=>`</span>) پس از ورود به " "عبارت `if` در داخل بلاک شاخه (پس از <span dir=ltr>`=>`</span>) پس از ورود به "
"اون شاخه خاص صدا زده میشود. اگر شرط `if` برقرار نباشد کاری به سایر شاخه های " "اون شاخه خاص صدا زده میشود. اگر شرط `if` برقرار نباشد کاری به سایر شاخه های "
"عبارت `match` اصلی ندارد." "عبارت `match` اصلی ندارد."
#: src/pattern-matching/match.md:53 #: src/pattern-matching/match.md:53
@ -5248,7 +5250,7 @@ msgstr "ساختارها"
#: src/pattern-matching/destructuring-structs.md:3 #: src/pattern-matching/destructuring-structs.md:3
msgid "Like tuples, Struct can also be destructured by matching:" msgid "Like tuples, Struct can also be destructured by matching:"
msgstr "" msgstr "مانند tuple ها، ساختار را نیز می توان با تطبیق تخریب کرد:"
#: src/pattern-matching/destructuring-structs.md:15 #: src/pattern-matching/destructuring-structs.md:15
msgid "\"x.0 = 1, b = {b}, y = {y}\"" msgid "\"x.0 = 1, b = {b}, y = {y}\""
@ -5282,7 +5284,7 @@ msgstr ""
#: src/pattern-matching/destructuring-enums.md:3 #: src/pattern-matching/destructuring-enums.md:3
msgid "Like tuples, enums can also be destructured by matching:" msgid "Like tuples, enums can also be destructured by matching:"
msgstr "" msgstr "مانند tuple ها، enum ها را نیز می توان با تطبیق تخریب کرد:"
#: src/pattern-matching/destructuring-enums.md:5 #: src/pattern-matching/destructuring-enums.md:5
msgid "" msgid ""
@ -5290,9 +5292,9 @@ msgid ""
"how you inspect the structure of your types. Let us start with a simple " "how you inspect the structure of your types. Let us start with a simple "
"`enum` type:" "`enum` type:"
msgstr "" msgstr ""
"الگوها همچنین می توانند برای انتساب متغیرها استفاده شوند.به این ترتیب ساختار " "الگوها همچنین می‌توانند برای متصل کردن متغیرها به بخش‌هایی از مقادیر شما "
نواع (Types) خود را بررسی می‌کنید. اجازه دهید با یک نوع `enum` ساده شروع " ستفاده شوند. این روش به شما اجازه می‌دهد ساختار انواع خود را بررسی کنید. "
"کنیم:" "بیایید با یک نوع ساده `enum` شروع کنیم:"
#: src/pattern-matching/destructuring-enums.md:18 #: src/pattern-matching/destructuring-enums.md:18
msgid "\"cannot divide {n} into two equal parts\"" msgid "\"cannot divide {n} into two equal parts\""
@ -5312,16 +5314,17 @@ msgid ""
"arm, `half` is bound to the value inside the `Ok` variant. In the second " "arm, `half` is bound to the value inside the `Ok` variant. In the second "
"arm, `msg` is bound to the error message." "arm, `msg` is bound to the error message."
msgstr "" msgstr ""
"در اینجا ما از شاخه‌ها برای `destructure` کردن مقدار `Result` استفاده " "اینجا از شاخه‌ها برای _تجزیه_ مقدار `Result` استفاده کرده‌ایم. در شاخه‌ی اول، "
"کرده‌ایم. در شاخه اول، `half` به مقداری داخل نوع `Ok` متصل می شود. در شاخه " "`half` به مقداری که درون حالت `Ok` قرار دارد متصل شده است. در شاخه‌ی دوم، "
"دوم، `msg` به نوع`Err` متصل می‌شود." "`msg` به پیام خطا متصل شده است."
#: src/pattern-matching/destructuring-enums.md:38 #: src/pattern-matching/destructuring-enums.md:38
msgid "" msgid ""
"The `if`/`else` expression is returning an enum that is later unpacked with " "The `if`/`else` expression is returning an enum that is later unpacked with "
"a `match`." "a `match`."
msgstr "" msgstr ""
"عبارت `if`/`else` یک `enum` را برمی گرداند که بعداً با `match` باز می شود." "عبارت `if`/`else` یک نوع enum بازمی‌گرداند که بعداً با استفاده از `match` از "
"هم باز می‌شود."
#: src/pattern-matching/destructuring-enums.md:40 #: src/pattern-matching/destructuring-enums.md:40
msgid "" msgid ""
@ -5334,23 +5337,19 @@ msgstr ""
"نحوه تلاش کامپایلر برای ارائه نکاتی به شما را نشان دهید." "نحوه تلاش کامپایلر برای ارائه نکاتی به شما را نشان دهید."
#: src/pattern-matching/destructuring-enums.md:43 #: src/pattern-matching/destructuring-enums.md:43
#, fuzzy
msgid "" msgid ""
"The values in the enum variants can only be accessed after being pattern " "The values in the enum variants can only be accessed after being pattern "
"matched." "matched."
msgstr "" msgstr "مقادیر در حالات enum تنها پس از تطبیق الگو قابل دسترسی هستند."
"مقادیر در`Enum` فقط پس از طییق الگوی قابل دسترسی هستند. الگو ارجاعی را به "
"فیلدهای موجود با استفاده بازوی `match` پس از <span dir=ltr>`=>`</span> "
"متصل می کند."
#: src/pattern-matching/destructuring-enums.md:45 #: src/pattern-matching/destructuring-enums.md:45
#, fuzzy
msgid "" msgid ""
"Demonstrate what happens when the search is inexhaustive. Note the advantage " "Demonstrate what happens when the search is inexhaustive. Note the advantage "
"the Rust compiler provides by confirming when all cases are handled." "the Rust compiler provides by confirming when all cases are handled."
msgstr "" msgstr ""
"این اتفاق را زمانی که الگوهای جستجو کامل نیستند نشان دهید. به مزیت کامپایلر " "نشان دهید چه اتفاقی می‌افتد وقتی جستجو (مطابقت) ناقص است. به مزیتی که "
"Rust که با تایید زمانی که همه موارد رسیدگی می‌شوند، اشاره کنید." "کامپایلر Rust فراهم می‌کند، اشاره کنید که تأیید می‌کند همه حالات پوشش داده "
"شده‌اند."
#: src/pattern-matching/destructuring-enums.md:47 #: src/pattern-matching/destructuring-enums.md:47
msgid "" msgid ""
@ -5361,12 +5360,22 @@ msgid ""
"io/rfcs/2005-match-ergonomics.html) appeared in Rust 2018. If you want to " "io/rfcs/2005-match-ergonomics.html) appeared in Rust 2018. If you want to "
"support older Rust, replace `msg` with `ref msg` in the pattern." "support older Rust, replace `msg` with `ref msg` in the pattern."
msgstr "" msgstr ""
"نتیجه‌ی تابع `divide_in_two` را در متغیر `result` ذخیره کنید و آن را در یک "
"حلقه با استفاده از `match` بررسی کنید. این کد کامپایل نمی‌شود زیرا `msg` "
"هنگام مطابقت مصرف می‌شود. برای رفع این مشکل، به جای `result` از `result&` "
"استفاده کنید. این کار باعث می‌شود `msg` به صورت یک ارجاع باشد و مصرف نشود. "
"این ویژگی که به نام [\"match ergonomics\"](https://rust-lang.github.io/"
"rfcs/2005-match-ergonomics.html) شناخته می‌شود، در Rust 2018 معرفی شده است. "
"اگر می‌خواهید از نسخه‌های قدیمی‌تر Rust پشتیبانی کنید، به جای `msg` از `ref "
"msg` در الگو استفاده کنید."
#: src/pattern-matching/let-control-flow.md:3 #: src/pattern-matching/let-control-flow.md:3
msgid "" msgid ""
"Rust has a few control flow constructs which differ from other languages. " "Rust has a few control flow constructs which differ from other languages. "
"They are used for pattern matching:" "They are used for pattern matching:"
msgstr "" msgstr ""
"زبان Rust چند ساختار کنترل جریان دارد که با سایر زبان‌ها متفاوت است. این "
"ساختارها برای مطابقت الگو استفاده می‌شوند:"
#: src/pattern-matching/let-control-flow.md:6 #: src/pattern-matching/let-control-flow.md:6
#: src/pattern-matching/let-control-flow.md:10 #: src/pattern-matching/let-control-flow.md:10
@ -5375,9 +5384,8 @@ msgstr "عبارت `if let`"
#: src/pattern-matching/let-control-flow.md:7 #: src/pattern-matching/let-control-flow.md:7
#: src/pattern-matching/let-control-flow.md:32 #: src/pattern-matching/let-control-flow.md:32
#, fuzzy
msgid "`let else` expressions" msgid "`let else` expressions"
msgstr "عبارت `while let`" msgstr "عبارت `let else`"
#: src/pattern-matching/let-control-flow.md:8 #: src/pattern-matching/let-control-flow.md:8
msgid "`while let` expressions" msgid "`while let` expressions"
@ -5404,6 +5412,10 @@ msgid ""
"let_else.html). The \"else\" case must diverge (`return`, `break`, or panic " "let_else.html). The \"else\" case must diverge (`return`, `break`, or panic "
"- anything but falling off the end of the block)." "- anything but falling off the end of the block)."
msgstr "" msgstr ""
"برای حالت رایج مطابقت با یک الگو و بازگشت از تابع، از [`let else`](https://"
"doc.rust-lang.org/rust-by-example/flow_control/let_else.html) استفاده کنید. "
"در اینجا، حالت \"else\" باید منحرف شود (مانند `return`، `break`، یا `panic` "
"- به غیر از اینکه از انتهای بلوک خارج شود)."
#: src/pattern-matching/let-control-flow.md:44 #: src/pattern-matching/let-control-flow.md:44
#: src/pattern-matching/let-control-flow.md:107 #: src/pattern-matching/let-control-flow.md:107
@ -5443,23 +5455,20 @@ msgstr ""
"مقابل الگو به طور مکرر (تکرار شونده‌ای) بررسی می‌کند:" "مقابل الگو به طور مکرر (تکرار شونده‌ای) بررسی می‌کند:"
#: src/pattern-matching/let-control-flow.md:81 #: src/pattern-matching/let-control-flow.md:81
#, fuzzy
msgid "" msgid ""
"Here [`String::pop`](https://doc.rust-lang.org/stable/std/string/struct." "Here [`String::pop`](https://doc.rust-lang.org/stable/std/string/struct."
"String.html#method.pop) returns `Some(c)` until the string is empty, after " "String.html#method.pop) returns `Some(c)` until the string is empty, after "
"which it will return `None`. The `while let` lets us keep iterating through " "which it will return `None`. The `while let` lets us keep iterating through "
"all items." "all items."
msgstr "" msgstr ""
"در اینجا، پیماینده (iterator) توسط <span dir=ltr>`v.into_iter()`</span> یک " "در اینجا [`String::pop`](https://doc.rust-lang.org/stable/std/string/struct."
"مقدار را برمیگرداند, یک <span dir=ltr>`Option<i32>`</span> را در هر فراخوانی " "String.html#method.pop) تا زمانی که رشته خالی نشده است، `Some(c)` را "
"به <span dir=ltr>`next()`</span> برمی گرداند. تا زمانی که محتوایی وجود داشته " "برمی‌گرداند و پس از آن `None` را باز می‌گرداند. استفاده از `while let` به ما "
"باشد این کار ادامه پیدا میکند و وقتی که تمام شد <span dir=ltr>`Some(x)`</" "این امکان را می‌دهد که به طور مداوم از میان همه موارد عبور کنیم."
"span> را برمی گرداند و پس از آن None را برمی گرداند. `while let` به ما امکان "
"می دهد همه مارد را به صورت کامل پیمایش کنیم."
#: src/pattern-matching/let-control-flow.md:89 #: src/pattern-matching/let-control-flow.md:89
msgid "if-let" msgid "if-let"
msgstr "" msgstr "if-let"
#: src/pattern-matching/let-control-flow.md:91 #: src/pattern-matching/let-control-flow.md:91
msgid "" msgid ""
@ -5485,7 +5494,7 @@ msgstr ""
#: src/pattern-matching/let-control-flow.md:96 #: src/pattern-matching/let-control-flow.md:96
msgid "let-else" msgid "let-else"
msgstr "" msgstr "let-else"
#: src/pattern-matching/let-control-flow.md:98 #: src/pattern-matching/let-control-flow.md:98
msgid "" msgid ""
@ -5493,15 +5502,18 @@ msgid ""
"flattening this nested code. Rewrite the awkward version for students, so " "flattening this nested code. Rewrite the awkward version for students, so "
"they can see the transformation." "they can see the transformation."
msgstr "" msgstr ""
"`if-let` ها می‌توانند به صورت تو در تو انباشته شوند، همان‌طور که در اینجا نشان "
"داده شده است. ساختار `let-else` از فلت کردن این کدهای تو در تو پشتیبانی "
"می‌کند. نسخه‌ی پیچیده را برای دانش‌آموزان بازنویسی کنید تا بتوانند تبدیل آن را "
"مشاهده کنند."
#: src/pattern-matching/let-control-flow.md:102 #: src/pattern-matching/let-control-flow.md:102
msgid "The rewritten version is:" msgid "The rewritten version is:"
msgstr "" msgstr "نسخه‌ی بازنویسی شده به صورت زیر است:"
#: src/pattern-matching/let-control-flow.md:122 #: src/pattern-matching/let-control-flow.md:122
#, fuzzy
msgid "while-let" msgid "while-let"
msgstr "حلقه `while let`" msgstr "while-let"
#: src/pattern-matching/let-control-flow.md:124 #: src/pattern-matching/let-control-flow.md:124
msgid "" msgid ""
@ -5512,38 +5524,33 @@ msgstr ""
"داشته باشد (شرط برقرار باشد)، ادامه خواهد داشت." "داشته باشد (شرط برقرار باشد)، ادامه خواهد داشت."
#: src/pattern-matching/let-control-flow.md:126 #: src/pattern-matching/let-control-flow.md:126
#, fuzzy
msgid "" msgid ""
"You could rewrite the `while let` loop as an infinite loop with an if " "You could rewrite the `while let` loop as an infinite loop with an if "
"statement that breaks when there is no value to unwrap for `name.pop()`. The " "statement that breaks when there is no value to unwrap for `name.pop()`. The "
"`while let` provides syntactic sugar for the above scenario." "`while let` provides syntactic sugar for the above scenario."
msgstr "" msgstr ""
"می‌توانید حلقه `while let` را به عنوان یک حلقه بی‌پایان با یک عبارت `if` " "شما می‌توانید حلقه‌ی `while let` را به صورت یک حلقه بی‌پایان با یک دستور `if` "
"بازنویسی کنید که زمانی که مقداری برای باز کردن <span dir=ltr>`iter.next()`</" "بازنویسی کنید که در صورت عدم وجود مقداری برای باز کردن (unwrap) از `()name."
"span> وجود ندارد، قطع می‌شود. `while let` مثل آب خوردن سناریو بالا رو برای " "pop`، شکسته می‌شود. `while let` یک Syntactic sugar برای این سناریو ارائه "
"شما فراهم می‌کند." "می‌دهد."
#: src/pattern-matching/exercise.md:3 #: src/pattern-matching/exercise.md:3
#, fuzzy
msgid "Let's write a simple recursive evaluator for arithmetic expressions." msgid "Let's write a simple recursive evaluator for arithmetic expressions."
msgstr "بیایید یک ارزیاب بازگشتی ساده برای عبارات حسابی بنویسیم." msgstr "بیایید یک ارزیاب ساده بازگشتی برای عبارات حسابی بنویسیم."
#: src/pattern-matching/exercise.md:5 #: src/pattern-matching/exercise.md:5
#, fuzzy
msgid "" msgid ""
"The `Box` type here is a smart pointer, and will be covered in detail later " "The `Box` type here is a smart pointer, and will be covered in detail later "
"in the course. An expression can be \"boxed\" with `Box::new` as seen in the " "in the course. An expression can be \"boxed\" with `Box::new` as seen in the "
"tests. To evaluate a boxed expression, use the deref operator (`*`) to " "tests. To evaluate a boxed expression, use the deref operator (`*`) to "
"\"unbox\" it: `eval(*boxed_expr)`." "\"unbox\" it: `eval(*boxed_expr)`."
msgstr "" msgstr ""
"نوع `Box` در اینجا یک اشاره گر هوشمند است و در ادامه دوره به طور مفصل مورد " "نوع `Box` در اینجا یک اشاره‌گر هوشمند است و در ادامه دوره به طور مفصل مورد "
"بحث قرار خواهد گرفت. یک عبارت را می‌توان با <span dir=ltr>`Box::new`</span> " "بررسی قرار خواهد گرفت. یک عبارت می‌تواند با استفاده از `Box::new` \"باکس\" "
"مانند آنچه در تست‌ها دیده می‌شود، «جعبه‌ای» کرد. برای ارزیابی یک عبارت جعبه‌ای، " "شود، همان‌طور که در تست‌ها مشاهده می‌شود. برای ارزیابی یک عبارت باکس‌شده، از "
"از عملگر `deref` برای «خارج کردن» آن استفاده کنید: <span " "عملگر deref (`*`) برای \"باز کردن باکس\" استفاده کنید: `eval(*boxed_expr)`."
"dir=ltr>`eval(*boxed_expr)`</span>"
#: src/pattern-matching/exercise.md:10 #: src/pattern-matching/exercise.md:10
#, fuzzy
msgid "" msgid ""
"Some expressions cannot be evaluated and will return an error. The standard " "Some expressions cannot be evaluated and will return an error. The standard "
"[`Result<Value, String>`](https://doc.rust-lang.org/std/result/enum.Result." "[`Result<Value, String>`](https://doc.rust-lang.org/std/result/enum.Result."
@ -5551,31 +5558,31 @@ msgid ""
"(`Ok(Value)`) or an error (`Err(String)`). We will cover this type in detail " "(`Ok(Value)`) or an error (`Err(String)`). We will cover this type in detail "
"later." "later."
msgstr "" msgstr ""
"برخی از عبارات قابل ارزیابی نیستند و خطایی را برمی‌گردانند. نوع `Res` " "برخی از عبارات نمی‌توانند ارزیابی شوند و خطا برمی‌گردانند. نوع استاندارد "
"نشان‌دهنده یک مقدار موفقیت‌آمیز یا یک خطا با پیام است. این بسیار شبیه به " "[`Result<Value, String>`](https://doc.rust-lang.org/std/result/enum.Result."
"`Result` کتابخانه استاندارد است که بعداً خواهیم دید." "html) یک enum است که یا نمایانگر یک مقدار موفقیت‌آمیز (`Ok(Value)`) یا یک خطا "
"(`Err(String)`) است. ما این نوع را به‌طور مفصل‌تر در آینده پوشش خواهیم داد."
#: src/pattern-matching/exercise.md:15 #: src/pattern-matching/exercise.md:15
#, fuzzy
msgid "" msgid ""
"Copy and paste the code into the Rust playground, and begin implementing " "Copy and paste the code into the Rust playground, and begin implementing "
"`eval`. The final product should pass the tests. It may be helpful to use " "`eval`. The final product should pass the tests. It may be helpful to use "
"`todo!()` and get the tests to pass one-by-one. You can also skip a test " "`todo!()` and get the tests to pass one-by-one. You can also skip a test "
"temporarily with `#[ignore]`:" "temporarily with `#[ignore]`:"
msgstr "" msgstr ""
"کد را کپی و در زمین بازی Rust پیست کنید و شروع به پیاده‌سازی `eval` کنید. " "کد را کپی و در Rust Playground پیست کنید و پیاده‌سازی تابع `eval` را آغاز "
"محصول نهایی باید تست‌ها را پشت سر بگذارد. ممکن است مفید باشد از <span " "کنید. محصول نهایی باید تست‌ها را پاس کند. ممکن است استفاده از `()!todo` و "
"dir=ltr>`todo!()`</span> استفاده کنید و تست‌ها را یکی یکی پاس دهید." "گذراندن تست‌ها به صورت تک به تک مفید باشد. همچنین می‌توانید به طور موقت یک تست "
"را با استفاده از `[ignore]#` نادیده بگیرید:"
#: src/pattern-matching/exercise.md:26 #: src/pattern-matching/exercise.md:26
#, fuzzy
msgid "" msgid ""
"If you finish early, try writing a test that results in division by zero or " "If you finish early, try writing a test that results in division by zero or "
"integer overflow. How could you handle this with `Result` instead of a panic?" "integer overflow. How could you handle this with `Result` instead of a panic?"
msgstr "" msgstr ""
"اگر زود تموم شد، سعی کنید تست‌ای بنویسید که منجر به سرریز عدد صحیح (integer " "اگر زودتر تمام کردید، سعی کنید یک تست بنویسید که منجر به تقسیم بر صفر یا "
"overflow) شود. چگونه می توانید این مشکل را با <span dir=ltr>`Res::Err`</" "سرریز عدد صحیح شود. چگونه می‌توانید این را با استفاده از `Result` به جای "
"span> به جای `panic` برطرف کنید؟" "panic مدیریت کنید؟"
#: src/pattern-matching/exercise.md:30 src/pattern-matching/solution.md:4 #: src/pattern-matching/exercise.md:30 src/pattern-matching/solution.md:4
msgid "/// An operation to perform on two subexpressions.\n" msgid "/// An operation to perform on two subexpressions.\n"
@ -5607,6 +5614,8 @@ msgid ""
"Rust allows you to associate functions with your new types. You do this with " "Rust allows you to associate functions with your new types. You do this with "
"an `impl` block:" "an `impl` block:"
msgstr "" msgstr ""
"Rust به شما این امکان را می‌دهد که توابعی را با تایپ جدید خود مرتبط کنید. این "
"کار را با استفاده از بلوک `impl` انجام می‌دهید:"
#: src/methods-and-traits/methods.md:14 #: src/methods-and-traits/methods.md:14
msgid "// No receiver, a static method\n" msgid "// No receiver, a static method\n"
@ -5649,18 +5658,25 @@ msgid ""
"The `self` arguments specify the \"receiver\" - the object the method acts " "The `self` arguments specify the \"receiver\" - the object the method acts "
"on. There are several common receivers for a method:" "on. There are several common receivers for a method:"
msgstr "" msgstr ""
"آرگومان‌های `self` \"گیرنده\" را مشخص می‌کنند - شیئی که متد بر روی آن عمل "
"می‌کند. چندین گیرنده رایج برای یک متد وجود دارد:"
#: src/methods-and-traits/methods.md:54 #: src/methods-and-traits/methods.md:54
msgid "" msgid ""
"`&self`: borrows the object from the caller using a shared and immutable " "`&self`: borrows the object from the caller using a shared and immutable "
"reference. The object can be used again afterwards." "reference. The object can be used again afterwards."
msgstr "" msgstr ""
"`self&`: شیئی را از فراخواننده با استفاده از یک مرجع مشترک و غیرقابل تغییر "
"قرض می‌گیرد. شیء می‌تواند بعداً دوباره استفاده شود."
#: src/methods-and-traits/methods.md:56 #: src/methods-and-traits/methods.md:56
msgid "" msgid ""
"`&mut self`: borrows the object from the caller using a unique and mutable " "`&mut self`: borrows the object from the caller using a unique and mutable "
"reference. The object can be used again afterwards." "reference. The object can be used again afterwards."
msgstr "" msgstr ""
"`mut self&`: شیء را از فراخواننده با استفاده از یک مرجع منحصر به فرد و قابل "
"تغییر قرض می‌گیرد. شی پس از آن نمی‌تواند دوباره استفاده شود تا زمانی که مرجع "
"به پایان برسد."
#: src/methods-and-traits/methods.md:58 #: src/methods-and-traits/methods.md:58
msgid "" msgid ""
@ -5669,26 +5685,33 @@ msgid ""
"(deallocated) when the method returns, unless its ownership is explicitly " "(deallocated) when the method returns, unless its ownership is explicitly "
"transmitted. Complete ownership does not automatically mean mutability." "transmitted. Complete ownership does not automatically mean mutability."
msgstr "" msgstr ""
"`self`: مالکیت شیء را به عهده می‌گیرد و آن را از فراخواننده منتقل می‌کند. متد "
"مالک شیء می‌شود. شیء هنگامی که متد باز می‌گردد حذف خواهد شد، مگر اینکه مالکیت "
"آن به‌طور صریح منتقل شود. مالکیت کامل به‌طور خودکار به معنای قابلیت تغییر نیست."
#: src/methods-and-traits/methods.md:62 #: src/methods-and-traits/methods.md:62
msgid "`mut self`: same as above, but the method can mutate the object." msgid "`mut self`: same as above, but the method can mutate the object."
msgstr "" msgstr "`mut self`: مشابه مورد بالا، اما متد می‌تواند شیء را تغییر دهد."
#: src/methods-and-traits/methods.md:63 #: src/methods-and-traits/methods.md:63
msgid "" msgid ""
"No receiver: this becomes a static method on the struct. Typically used to " "No receiver: this becomes a static method on the struct. Typically used to "
"create constructors which are called `new` by convention." "create constructors which are called `new` by convention."
msgstr "" msgstr ""
"بدون گیرنده: این تبدیل به یک متد استاتیک در ساختار می‌شود. معمولاً برای ایجاد "
"سازنده‌ها استفاده می‌شود که به‌طور معمول `new` نامیده می‌شوند."
#: src/methods-and-traits/methods.md:71 #: src/methods-and-traits/methods.md:71
msgid "It can be helpful to introduce methods by comparing them to functions." msgid "It can be helpful to introduce methods by comparing them to functions."
msgstr "" msgstr "مفید است که متدها را با مقایسه آنها با توابع معرفی کنیم."
#: src/methods-and-traits/methods.md:72 #: src/methods-and-traits/methods.md:72
msgid "" msgid ""
"Methods are called on an instance of a type (such as a struct or enum), the " "Methods are called on an instance of a type (such as a struct or enum), the "
"first parameter represents the instance as `self`." "first parameter represents the instance as `self`."
msgstr "" msgstr ""
"متدها بر روی یک نمونه از تایپی (مانند struct یا enum) فراخوانی می‌شوند، و "
"پارامتر اول نمونه را به‌عنوان نمونه `self`."
#: src/methods-and-traits/methods.md:74 #: src/methods-and-traits/methods.md:74
msgid "" msgid ""
@ -5696,34 +5719,47 @@ msgid ""
"syntax and to help keep them more organized. By using methods we can keep " "syntax and to help keep them more organized. By using methods we can keep "
"all the implementation code in one predictable place." "all the implementation code in one predictable place."
msgstr "" msgstr ""
"توسعه‌دهندگان ممکن است تصمیم بگیرند از متدها استفاده کنند تا از نحو گیرنده "
"متد بهره‌برداری کنند و به سازمان‌دهی بهتر کد کمک کنند. با استفاده از متدها، "
"می‌توانیم تمامی کدهای پیاده‌سازی را در یک مکان قابل پیش‌بینی نگه داریم."
#: src/methods-and-traits/methods.md:77 #: src/methods-and-traits/methods.md:77
msgid "Point out the use of the keyword `self`, a method receiver." msgid "Point out the use of the keyword `self`, a method receiver."
msgstr "" msgstr ""
"استفاده از کلمه کلیدی `self`، که به‌عنوان گیرنده متد عمل می‌کند، را مشخص کنید."
#: src/methods-and-traits/methods.md:78 #: src/methods-and-traits/methods.md:78
msgid "" msgid ""
"Show that it is an abbreviated term for `self: Self` and perhaps show how " "Show that it is an abbreviated term for `self: Self` and perhaps show how "
"the struct name could also be used." "the struct name could also be used."
msgstr "" msgstr ""
"نشان دهید که `self` یک اصطلاح کوتاه‌شده برای `self: Self` است و شاید نشان "
"دهید که چگونه نام struct نیز می‌تواند استفاده شود."
#: src/methods-and-traits/methods.md:80 #: src/methods-and-traits/methods.md:80
msgid "" msgid ""
"Explain that `Self` is a type alias for the type the `impl` block is in and " "Explain that `Self` is a type alias for the type the `impl` block is in and "
"can be used elsewhere in the block." "can be used elsewhere in the block."
msgstr "" msgstr ""
"توضیح دهید که `Self` یک نام مستعار نوع برای تایپ است که بلوک `impl` در آن "
"قرار دارد و می‌تواند در سایر بخش‌های بلوک استفاده شود."
#: src/methods-and-traits/methods.md:82 #: src/methods-and-traits/methods.md:82
#, fuzzy
msgid "" msgid ""
"Note how `self` is used like other structs and dot notation can be used to " "Note how `self` is used like other structs and dot notation can be used to "
"refer to individual fields." "refer to individual fields."
msgstr "" msgstr ""
"توجه کنید که چگونه `self` مانند سایر ساختارها استفاده می‌شود و dot notation "
"می‌تواند برای ارجاع به فیلدهای فردی به کار رود."
#: src/methods-and-traits/methods.md:84 #: src/methods-and-traits/methods.md:84
msgid "" msgid ""
"This might be a good time to demonstrate how the `&self` differs from `self` " "This might be a good time to demonstrate how the `&self` differs from `self` "
"by trying to run `finish` twice." "by trying to run `finish` twice."
msgstr "" msgstr ""
"این ممکن است زمان مناسبی باشد برای نشان دادن تفاوت بین `self&` و `self` با "
"تلاش برای اجرای متد `finish` دو بار."
#: src/methods-and-traits/methods.md:86 #: src/methods-and-traits/methods.md:86
msgid "" msgid ""
@ -5731,11 +5767,16 @@ msgid ""
"doc.rust-lang.org/reference/special-types-and-traits.html) allowed to be " "doc.rust-lang.org/reference/special-types-and-traits.html) allowed to be "
"receiver types, such as `Box<Self>`." "receiver types, such as `Box<Self>`."
msgstr "" msgstr ""
"فراتر از حالت‌های مختلف `self`، تایپ‌های [special wrapper types](https://doc."
"rust-lang.org/reference/special-types-and-traits.html) نیز وجود دارند که "
"به‌عنوان تایپ‌های گیرنده مجاز هستند، مانند `<Box<Self`."
#: src/methods-and-traits/traits.md:3 #: src/methods-and-traits/traits.md:3
msgid "" msgid ""
"Rust lets you abstract over types with traits. They're similar to interfaces:" "Rust lets you abstract over types with traits. They're similar to interfaces:"
msgstr "" msgstr ""
"راست به شما این امکان را می‌دهد که با استفاده از traits بر روی تایپ‌ها انتزاع "
"ایجاد کنید. آنها مشابه interface ها هستند:"
#: src/methods-and-traits/traits.md:7 #: src/methods-and-traits/traits.md:7
msgid "/// Return a sentence from this pet.\n" msgid "/// Return a sentence from this pet.\n"
@ -5750,12 +5791,16 @@ msgid ""
"A trait defines a number of methods that types must have in order to " "A trait defines a number of methods that types must have in order to "
"implement the trait." "implement the trait."
msgstr "" msgstr ""
"یک trait مجموعه‌ای از متدها را تعریف می‌کند که تایپ‌ها باید آن‌ها را داشته باشند "
"تا بتوانند آن trait را پیاده‌سازی کنند."
#: src/methods-and-traits/traits.md:21 #: src/methods-and-traits/traits.md:21
msgid "" msgid ""
"In the \"Generics\" segment, next, we will see how to build functionality " "In the \"Generics\" segment, next, we will see how to build functionality "
"that is generic over all types implementing a trait." "that is generic over all types implementing a trait."
msgstr "" msgstr ""
"در بخش \"Generics\"، در ادامه خواهیم دید که چگونه می‌توانیم عملکردی بسازیم که "
"generic بر روی تمام تایپ‌های که یک trait را پیاده‌سازی کرده‌اند باشد."
#: src/methods-and-traits/traits/implementing.md:8 #: src/methods-and-traits/traits/implementing.md:8
msgid "\"Oh you're a cutie! What's your name? {}\"" msgid "\"Oh you're a cutie! What's your name? {}\""
@ -5776,6 +5821,8 @@ msgid ""
"To implement `Trait` for `Type`, you use an `impl Trait for Type { .. }` " "To implement `Trait` for `Type`, you use an `impl Trait for Type { .. }` "
"block." "block."
msgstr "" msgstr ""
"برای پیاده‌سازی `Trait` برای `Type`، از بلوک `{ .. } impl Trait for Type` "
"استفاده می‌کنید."
#: src/methods-and-traits/traits/implementing.md:34 #: src/methods-and-traits/traits/implementing.md:34
msgid "" msgid ""
@ -5783,6 +5830,9 @@ msgid ""
"type with a `talk()` method would not automatically satisfy `Pet` unless it " "type with a `talk()` method would not automatically satisfy `Pet` unless it "
"is in an `impl Pet` block." "is in an `impl Pet` block."
msgstr "" msgstr ""
"برخلاف رابط‌های Go، داشتن فقط متدهای مطابقت‌دهنده کافی نیست: نوع `Cat` با متد "
"`()talk` به‌طور خودکار `Pet` را برآورده نمی‌کند، مگر اینکه در یک بلوک `impl "
"Pet` قرار داشته باشد."
#: src/methods-and-traits/traits/implementing.md:38 #: src/methods-and-traits/traits/implementing.md:38
msgid "" msgid ""
@ -5790,6 +5840,9 @@ msgid ""
"implementations can rely on all the methods of the trait. In this case, " "implementations can rely on all the methods of the trait. In this case, "
"`greet` is provided, and relies on `talk`." "`greet` is provided, and relies on `talk`."
msgstr "" msgstr ""
"Traits ممکن است پیاده‌سازی‌های پیش‌فرض برای برخی از متدها ارائه دهند. "
"پیاده‌سازی‌های پیش‌فرض می‌توانند به تمامی متدهای trait وابسته باشند. در این "
"مورد، `greet` ارائه شده است و به `talk` وابسته است."
#: src/methods-and-traits/traits/supertraits.md:3 #: src/methods-and-traits/traits/supertraits.md:3
msgid "" msgid ""
@ -5797,6 +5850,9 @@ msgid ""
"called _supertraits_. Here, any type implementing `Pet` must implement " "called _supertraits_. Here, any type implementing `Pet` must implement "
"`Animal`." "`Animal`."
msgstr "" msgstr ""
"یک trait می‌تواند نیاز داشته باشد که تایپ‌هایی که آن را پیاده‌سازی می‌کنند، "
"همچنین traits دیگری به نام _supertraits_ را نیز پیاده‌سازی کنند. در اینجا، هر "
"نوعی که `Pet` را پیاده‌سازی کند، باید `Animal` را نیز پیاده‌سازی کند."
#: src/methods-and-traits/traits/supertraits.md:30 #: src/methods-and-traits/traits/supertraits.md:30
#: src/concurrency/async-control-flow/select.md:44 #: src/concurrency/async-control-flow/select.md:44
@ -5813,12 +5869,16 @@ msgid ""
"expect this to behave like OO inheritance. It just specifies an additional " "expect this to behave like OO inheritance. It just specifies an additional "
"requirement on implementations of a trait." "requirement on implementations of a trait."
msgstr "" msgstr ""
"این گاهی اوقات \"trait inheritance\" نامیده می‌شود، اما دانش‌آموزان نباید "
"انتظار داشته باشند که این رفتار مشابه وراثت در برنامه‌نویسی شیءگرا (OO) باشد. "
"این تنها یک الزام اضافی بر روی پیاده‌سازی‌های یک trait را مشخص می‌کند."
#: src/methods-and-traits/traits/associated-types.md:3 #: src/methods-and-traits/traits/associated-types.md:3
msgid "" msgid ""
"Associated types are placeholder types which are supplied by the trait " "Associated types are placeholder types which are supplied by the trait "
"implementation." "implementation."
msgstr "" msgstr ""
"تایپ‌های مرتبط تایپ‌هایی جایگزین هستند که توسط پیاده‌سازی trait تأمین می‌شوند."
#: src/methods-and-traits/traits/associated-types.md:25 #: src/methods-and-traits/traits/associated-types.md:25
#: src/concurrency/async-control-flow/join.md:30 #: src/concurrency/async-control-flow/join.md:30
@ -5830,18 +5890,24 @@ msgid ""
"Associated types are sometimes also called \"output types\". The key " "Associated types are sometimes also called \"output types\". The key "
"observation is that the implementer, not the caller, chooses this type." "observation is that the implementer, not the caller, chooses this type."
msgstr "" msgstr ""
"تایپ‌های مرتبط گاهی اوقات \"تایپ‌های خروجی\" نیز نامیده می‌شوند. نکته کلیدی این "
"است که پیاده‌ساز، نه فراخواننده، این تایپ را انتخاب می‌کند."
#: src/methods-and-traits/traits/associated-types.md:34 #: src/methods-and-traits/traits/associated-types.md:34
msgid "" msgid ""
"Many standard library traits have associated types, including arithmetic " "Many standard library traits have associated types, including arithmetic "
"operators and `Iterator`." "operators and `Iterator`."
msgstr "" msgstr ""
"بسیاری از traitهای کتابخانه استاندارد دارای نوع‌های مرتبط هستند، از جمله "
"اپراتورهای حسابی و `Iterator`."
#: src/methods-and-traits/deriving.md:3 #: src/methods-and-traits/deriving.md:3
msgid "" msgid ""
"Supported traits can be automatically implemented for your custom types, as " "Supported traits can be automatically implemented for your custom types, as "
"follows:" "follows:"
msgstr "" msgstr ""
"Traitهای پشتیبانی‌شده می‌توانند به‌طور خودکار برای تایپ‌های سفارشی شما پیاده‌سازی "
"شوند، به شرح زیر:"
#: src/methods-and-traits/deriving.md:15 #: src/methods-and-traits/deriving.md:15
msgid "// Default trait adds `default` constructor.\n" msgid "// Default trait adds `default` constructor.\n"
@ -5869,11 +5935,14 @@ msgid ""
"macros to add useful functionality. For example, `serde` can derive " "macros to add useful functionality. For example, `serde` can derive "
"serialization support for a struct using `#[derive(Serialize)]`." "serialization support for a struct using `#[derive(Serialize)]`."
msgstr "" msgstr ""
"انتساب (Derivation) با استفاده از ماکروها پیاده‌سازی می‌شود و بسیاری از "
"crateها ماکروهای مفیدی برای اضافه کردن قابلیت‌های کاربردی ارائه می‌دهند. به "
"عنوان مثال، `serde` می‌تواند پشتیبانی از ترتیب را برای یک ساختار با استفاده "
"از `[derive(Serialize)]#` فراهم کند."
#: src/methods-and-traits/exercise.md:1 #: src/methods-and-traits/exercise.md:1
#, fuzzy
msgid "Exercise: Logger Trait" msgid "Exercise: Logger Trait"
msgstr "تمرین: شمارنده" msgstr "تمرین: Trait Logger"
#: src/methods-and-traits/exercise.md:3 #: src/methods-and-traits/exercise.md:3
msgid "" msgid ""
@ -5882,6 +5951,10 @@ msgid ""
"In testing, this might put messages in the test logfile, while in a " "In testing, this might put messages in the test logfile, while in a "
"production build it would send messages to a log server." "production build it would send messages to a log server."
msgstr "" msgstr ""
"بیایید یک ابزار لاگ‌ ساده طراحی کنیم که از یک trait به نام `Logger` با متد "
"`log` استفاده کند. کدی که ممکن است پیشرفت خود را لاگ کند می‌تواند یک `impl "
"Logger&` دریافت کند. در زمان تست، این ممکن است پیام‌ها را در فایل‌ لاگ تست "
"قرار دهد، در حالی که در نسخه تولید، پیام‌ها به یک سرور لاگ ارسال می‌شود."
#: src/methods-and-traits/exercise.md:8 #: src/methods-and-traits/exercise.md:8
msgid "" msgid ""
@ -5889,6 +5962,10 @@ msgid ""
"verbosity. Your task is to write a `VerbosityFilter` type that will ignore " "verbosity. Your task is to write a `VerbosityFilter` type that will ignore "
"messages above a maximum verbosity." "messages above a maximum verbosity."
msgstr "" msgstr ""
"با این حال، `StderrLogger` که در زیر داده شده است، تمامی پیام‌ها را بدون توجه "
"به سطح جزئیات لاگ می‌کند. وظیفه شما این است که نوع `VerbosityFilter` را "
"بنویسید که پیام‌هایی با سطح جزئیات بالاتر از حداکثر سطح تعیین‌شده را نادیده "
"بگیرد."
#: src/methods-and-traits/exercise.md:12 #: src/methods-and-traits/exercise.md:12
msgid "" msgid ""
@ -5896,6 +5973,9 @@ msgid ""
"implementing that same trait, adding behavior in the process. What other " "implementing that same trait, adding behavior in the process. What other "
"kinds of wrappers might be useful in a logging utility?" "kinds of wrappers might be useful in a logging utility?"
msgstr "" msgstr ""
"این الگو الگوی رایجی است: یک ساختارکه یک پیاده‌سازی trait را در بر می‌گیرد و "
"همان trait را پیاده‌سازی می‌کند و در این فرآیند به آن رفتار اضافی می‌دهد. چه "
"نوع‌های دیگری از پوشش‌دهنده‌ها ممکن است در یک ابزار لاگ مفید باشند؟"
#: src/methods-and-traits/exercise.md:20 src/methods-and-traits/solution.md:7 #: src/methods-and-traits/exercise.md:20 src/methods-and-traits/solution.md:7
msgid "/// Log a message at the given verbosity level.\n" msgid "/// Log a message at the given verbosity level.\n"