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