From bbc2308d864908a9287de650fbf1bd281ffb7e0c Mon Sep 17 00:00:00 2001 From: Alix <dev.alix13@gmail.com> Date: Thu, 8 Aug 2024 12:44:31 +0330 Subject: [PATCH] [fa] day 2 afternoon (#2267) --- po/fa.po | 524 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 426 insertions(+), 98 deletions(-) diff --git a/po/fa.po b/po/fa.po index c3e3e7bd..9730163e 100644 --- a/po/fa.po +++ b/po/fa.po @@ -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-08-05 19:35+0330\n" +"PO-Revision-Date: 2024-08-07 22:37+0330\n" "Last-Translator: alix1383 <dev.alix13@gmail.com>\n" "Language-Team: Persian\n" "Language: fa\n" @@ -338,11 +338,11 @@ msgstr "Generics" #: src/SUMMARY.md src/generics.md src/generics/generic-functions.md:1 msgid "Generic Functions" -msgstr "" +msgstr "توابع Generic" #: src/SUMMARY.md src/generics.md src/generics/generic-data.md:1 msgid "Generic Data Types" -msgstr "انواع دادهها جنریک (Generic Data Types)" +msgstr "دیتا تایپهای Generic" #: src/SUMMARY.md src/generics/generic-traits.md:1 msgid "Generic Traits" @@ -350,25 +350,24 @@ msgstr "Generic Traits" #: src/SUMMARY.md src/generics.md src/generics/trait-bounds.md:1 msgid "Trait Bounds" -msgstr "صفات مرزی (Trait Bounds)" +msgstr "Trait Bounds" #: src/SUMMARY.md src/generics/impl-trait.md:1 msgid "`impl Trait`" -msgstr "" +msgstr "`impl Trait`" #: src/SUMMARY.md src/generics/dyn-trait.md:1 -#, fuzzy msgid "`dyn Trait`" -msgstr "صفات Async" +msgstr "`dyn Trait`" #: src/SUMMARY.md src/generics/exercise.md:1 msgid "Exercise: Generic `min`" -msgstr "" +msgstr "تمرین: Generic `min`" #: src/SUMMARY.md src/running-the-course/course-structure.md:44 #: src/welcome-day-2-afternoon.md src/std-types.md msgid "Standard Library Types" -msgstr "کتابخانه استاندارد انواع داده" +msgstr "کتابخانه استاندارد تایپها" #: src/SUMMARY.md src/std-types.md src/std-types/std.md:1 msgid "Standard Library" @@ -380,24 +379,24 @@ msgstr "مستندات" #: src/SUMMARY.md msgid "`Option`" -msgstr "" +msgstr "`Option`" #: src/SUMMARY.md src/error-handling/result.md:1 msgid "`Result`" -msgstr "" +msgstr "`Result`" #: src/SUMMARY.md src/android/aidl/types/primitives.md:14 #: src/android/interoperability/cpp/type-mapping.md:5 msgid "`String`" -msgstr "" +msgstr "`String`" #: src/SUMMARY.md src/std-types/vec.md:1 msgid "`Vec`" -msgstr "" +msgstr "`Vec`" #: src/SUMMARY.md src/std-types/hashmap.md:1 src/bare-metal/no_std.md msgid "`HashMap`" -msgstr "" +msgstr "`HashMap`" #: src/SUMMARY.md src/std-types.md src/std-types/exercise.md:1 msgid "Exercise: Counter" @@ -406,7 +405,7 @@ msgstr "تمرین: شمارنده" #: src/SUMMARY.md src/running-the-course/course-structure.md:45 #: src/welcome-day-2-afternoon.md src/std-traits.md msgid "Standard Library Traits" -msgstr "کتابخانه استاندارد برای تریتها" +msgstr "کتابخانه استاندارد Traits" #: src/SUMMARY.md src/std-traits.md src/std-traits/comparisons.md:1 #: src/concurrency/welcome-async.md @@ -419,27 +418,27 @@ msgstr "اپراتورها" #: src/SUMMARY.md src/std-traits/from-and-into.md:1 msgid "`From` and `Into`" -msgstr "" +msgstr "`From` and `Into`" #: src/SUMMARY.md src/std-traits.md src/std-traits/casting.md:1 msgid "Casting" -msgstr "" +msgstr "Casting" #: src/SUMMARY.md src/std-traits/read-and-write.md:1 msgid "`Read` and `Write`" -msgstr "" +msgstr "`Read` and `Write`" #: src/SUMMARY.md msgid "`Default`, struct update syntax" -msgstr "" +msgstr "`Default`, struct update syntax" #: src/SUMMARY.md src/std-traits.md src/std-traits/closures.md:1 msgid "Closures" -msgstr "" +msgstr "Closures" #: src/SUMMARY.md src/std-traits.md src/std-traits/exercise.md:1 msgid "Exercise: ROT13" -msgstr "" +msgstr "تمرین: ROT13" #: src/SUMMARY.md msgid "Day 3: Morning" @@ -6002,37 +6001,37 @@ msgid "/// Only log messages up to the given verbosity level.\n" msgstr "" #: src/welcome-day-2-afternoon.md -#, fuzzy msgid "" "Including 10 minute breaks, this session should take about 3 hours and 15 " "minutes. It contains:" msgstr "" -"با احتساب 10 دقیقه استراحت، این جلسه باید حدود 2 ساعت و 5 دقیقه طول بکشد. آن " -"شامل:" +"با احتساب ۱۰ دقیقه استراحت، این جلسه باید حدود ۳ ساعت و ۱۵ دقیقه طول بکشد. " +"آن شامل:" #: src/generics.md src/iterators.md src/testing.md msgid "This segment should take about 45 minutes. It contains:" -msgstr "" +msgstr "این بخش باید حدود ۴۵ دقیقه طول بکشد. آن شامل:" #: src/generics.md msgid "impl Trait" -msgstr "صفات impl (impl Trait)" +msgstr "impl Trait" #: src/generics.md -#, fuzzy msgid "dyn Trait" -msgstr "صفات Async" +msgstr "dyn Trait" #: src/generics.md -#, fuzzy msgid "Exercise: Generic min" -msgstr "تمرین: هندسه" +msgstr "تمرین: Generic `min`" #: src/generics/generic-functions.md:3 msgid "" "Rust supports generics, which lets you abstract algorithms or data " "structures (such as sorting or a binary tree) over the types used or stored." msgstr "" +"Rust از generics پشتیبانی میکند که به شما امکان میدهد الگوریتمها یا " +"ساختارهای داده (مانند مرتبسازی یا درخت دودویی) را بر روی تایپهای استفادهشده " +"یا ذخیرهشده تخصیص دهید." #: src/generics/generic-functions.md:7 msgid "/// Pick `even` or `odd` depending on the value of `n`.\n" @@ -6058,7 +6057,7 @@ msgstr "" msgid "" "Rust infers a type for T based on the types of the arguments and return " "value." -msgstr "" +msgstr "Rust تایپ T را بر اساس تایپ آرگومانها و مقدار بازگشتی استنباط میکند." #: src/generics/generic-functions.md:27 msgid "" @@ -6068,6 +6067,12 @@ msgid "" "`n == 0`. Even if only the `pick` instantiation with integers is used, Rust " "still considers it invalid. C++ would let you do this." msgstr "" +"این شبیه به الگوهای در ++C است، اما Rust تابع generic را بلافاصله به صورت " +"جزئی کامپایل میکند، بنابراین آن تابع باید برای تمام تایپهایی که با محدودیتها " +"مطابقت دارند معتبر باشد. به عنوان مثال، سعی کنید تابع `pick` را طوری تغییر " +"دهید که اگر `n == 0` باشد، مقدار `even + odd` را برگرداند. حتی اگر فقط " +"نمونهسازی تابع `pick` با اعداد صحیح استفاده شود، Rust همچنان آن را نامعتبر " +"در نظر میگیرد. اما ++C اجازه این کار را به شما میدهد." #: src/generics/generic-functions.md:33 msgid "" @@ -6075,10 +6080,13 @@ msgid "" "is a zero-cost abstraction: you get exactly the same result as if you had " "hand-coded the data structures without the abstraction." msgstr "" +"کد generic بر اساس محلهای فراخوانی به کد non-generic تبدیل میشود. این یک " +"انتزاع بدون هزینه است: شما دقیقاً همان نتیجهای را دریافت میکنید که گویی " +"ساختارهای داده را بدون انتزاع به صورت دستی کدنویسی کردهاید." #: src/generics/generic-data.md:3 msgid "You can use generics to abstract over the concrete field type:" -msgstr "" +msgstr "میتوانید از generic ها برای انتزاع نوع فیلد مشخص استفاده کنید:" #: src/generics/generic-data.md:25 msgid "\"{integer:?} and {float:?}\"" @@ -6093,26 +6101,32 @@ msgid "" "_Q:_ Why `T` is specified twice in `impl<T> Point<T> {}`? Isn't that " "redundant?" msgstr "" +"_سوال:_ چرا `T` در عبارت `{}<impl<T> Point<T` دوبار مشخص شده است؟ آیا این " +"تکراری نیست؟" #: src/generics/generic-data.md:35 msgid "" "This is because it is a generic implementation section for generic type. " "They are independently generic." msgstr "" +"این به این دلیل است که این یک بخش پیادهسازی generic برای تایپ generic است. " +"آنها بهطور مستقل generic هستند." #: src/generics/generic-data.md:37 msgid "It means these methods are defined for any `T`." -msgstr "" +msgstr "این به این معناست که این متدها برای هر نوع `T` تعریف شدهاند." #: src/generics/generic-data.md:38 msgid "It is possible to write `impl Point<u32> { .. }`." -msgstr "" +msgstr "این امکان وجود دارد که `{ .. }<impl Point<u32` را بنویسید." #: src/generics/generic-data.md:39 msgid "" "`Point` is still generic and you can use `Point<f64>`, but methods in this " "block will only be available for `Point<u32>`." msgstr "" +"`Point` هنوز هم generic است و میتوانید از `<Point<f64` استفاده کنید، اما " +"متدهای موجود در این بلوک تنها برای `<Point<u32` در دسترس خواهند بود." #: src/generics/generic-data.md:42 msgid "" @@ -6120,12 +6134,17 @@ msgid "" "code to allow points that have elements of different types, by using two " "type variables, e.g., `T` and `U`." msgstr "" +"سعی کنید یک متغیر جدید با `let p = Point { x: 5, y: 10.0 };` بسازید. کد را " +"بهروزرسانی کنید تا نقاطی که دارای عناصر با تایپهای مختلف هستند را مجاز کند، " +"با استفاده از دو تایپ متغیر، مانند `T` و `U`." #: src/generics/generic-traits.md:3 msgid "" "Traits can also be generic, just like types and functions. A trait's " "parameters get concrete types when it is used." msgstr "" +"Traits نیز میتوانند generic باشند، درست مانند تایپ و توابع. پارامترهای یک " +"trait زمانی که استفاده میشود، تایپهای مشخصی پیدا میکنند." #: src/generics/generic-traits.md:12 msgid "\"Converted from integer: {from}\"" @@ -6145,6 +6164,8 @@ msgid "" "the `std` docs](https://doc.rust-lang.org/std/convert/trait.From.html) is " "simple." msgstr "" +"`From` trait در ادامه دوره پوشش داده خواهد شد، اما [تعریف آن در مستندات " +"`std`](https://doc.rust-lang.org/std/convert/trait.From.html) ساده است." #: src/generics/generic-traits.md:35 msgid "" @@ -6152,6 +6173,9 @@ msgid "" "parameters. Here, `Foo::from(\"hello\")` would not compile because there is " "no `From<&str>` implementation for `Foo`." msgstr "" +"پیادهسازیهای trait نیازی به پوشش تمام پارامترهای تایپ ممکن ندارند. در اینجا، " +"`Foo::from(\"hello\")` کامپایل نخواهد شد زیرا پیادهسازی `<From<&str` برای " +"`Foo` وجود ندارد." #: src/generics/generic-traits.md:39 msgid "" @@ -6159,6 +6183,9 @@ msgid "" "\"output\" type. A trait can have multiple implementations for different " "input types." msgstr "" +"traitهای Generic تایپها را بهعنوان \"ورودی\" میپذیرند، در حالی که تایپ مرتبط " +"تایپ از \"خروجی\" هستند. یک trait میتواند پیادهسازیهای مختلفی برای تایپهای " +"ورودی متفاوت داشته باشد." #: src/generics/generic-traits.md:43 msgid "" @@ -6168,16 +6195,24 @@ msgid "" "[specialization](https://rust-lang.github.io/rfcs/1210-impl-specialization." "html)." msgstr "" +"در واقع، Rust نیاز دارد که حداکثر یک پیادهسازی از یک trait برای هر تایپ `T` " +"تطابق داشته باشد. بر خلاف برخی زبانهای دیگر، Rust هیچ قاعدهای برای انتخاب " +"\"مشخصترین\" تطابق را ندارد. در حال حاضر، کارهایی برای اضافه کردن این " +"پشتیبانی وجود دارد که به آن [ویژهسازی](https://rust-lang.github.io/rfcs/1210-" +"impl-specialization.html) میگویند." #: src/generics/trait-bounds.md:3 msgid "" "When working with generics, you often want to require the types to implement " "some trait, so that you can call this trait's methods." msgstr "" +"هنگام کار با genericها، معمولاً میخواهید نیاز داشته باشید که تایپ، trait ترید " +"خاص را پیادهسازی کنند، تا بتوانید متدهای آن trait را فراخوانی کنید." #: src/generics/trait-bounds.md:6 msgid "You can do this with `T: Trait` or `impl Trait`:" msgstr "" +"میتوانید این کار را با استفاده از `T: Trait` یا `impl Trait` انجام دهید:" #: src/generics/trait-bounds.md:12 msgid "// struct NotClonable;\n" @@ -6189,41 +6224,52 @@ msgstr "" #: src/generics/trait-bounds.md:25 msgid "Try making a `NonClonable` and passing it to `duplicate`." -msgstr "" +msgstr "سعی کنید یک `NonClonable` بسازید و آن را به `duplicate` پاس دهید." #: src/generics/trait-bounds.md:27 msgid "When multiple traits are necessary, use `+` to join them." -msgstr "" +msgstr "زمانی که چندین ترید لازم است، از `+` برای ترکیب آنها استفاده کنید." #: src/generics/trait-bounds.md:29 msgid "Show a `where` clause, students will encounter it when reading code." msgstr "" +"یک عبارت `where` را نشان دهید، زیرا دانشآموزان هنگام خواندن کد با آن مواجه " +"خواهند شد." #: src/generics/trait-bounds.md:40 msgid "It declutters the function signature if you have many parameters." msgstr "" +"اگر تعداد پارامترها زیاد باشد، استفاده از عبارت `where` باعث میشود که امضای " +"تابع مرتبتر و خواناتر باشد." #: src/generics/trait-bounds.md:41 msgid "It has additional features making it more powerful." -msgstr "" +msgstr "این ویژگیهای اضافی دارد که آن را قدرتمندتر میکند." #: src/generics/trait-bounds.md:42 msgid "" "If someone asks, the extra feature is that the type on the left of \":\" can " "be arbitrary, like `Option<T>`." msgstr "" +"اگر کسی بپرسد، ویژگی اضافی این است که تایپ در سمت چپ `:` میتواند دلخواه " +"باشد، مانند `<Option<T`." #: src/generics/trait-bounds.md:45 msgid "" "Note that Rust does not (yet) support specialization. For example, given the " "original `duplicate`, it is invalid to add a specialized `duplicate(a: u32)`." msgstr "" +"توجه داشته باشید که Rust (هنوز) پشتیبانی از ویژهسازی را ندارد. به عنوان " +"مثال، با توجه به `duplicate` اصلی، اضافه کردن یک پیادهسازی ویژهشده مانند " +"`duplicate(a: u32)` نامعتبر است." #: src/generics/impl-trait.md:3 msgid "" "Similar to trait bounds, an `impl Trait` syntax can be used in function " "arguments and return values:" msgstr "" +"مشابه با محدودیتهای trait، میتوان از `impl Trait` syntax در آرگومانهای تابع " +"و مقادیر بازگشتی استفاده کرد:" #: src/generics/impl-trait.md:7 msgid "" @@ -6248,12 +6294,16 @@ 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." msgstr "" +"`impl Trait` به شما اجازه میدهد با تایپهایی کار کنید که نمیتوانید نام ببرید. " +"معنی `impl Trait` در موقعیتهای مختلف کمی متفاوت است." #: src/generics/impl-trait.md:33 msgid "" "For a parameter, `impl Trait` is like an anonymous generic parameter with a " "trait bound." msgstr "" +"برای یک پارامتر، `impl Trait` شبیه به یک پارامتر generic ناشناخته با یک " +"محدودیت trait است." #: src/generics/impl-trait.md:36 msgid "" @@ -6261,6 +6311,9 @@ msgid "" "implements the trait, without naming the type. This can be useful when you " "don't want to expose the concrete type in a public API." msgstr "" +"برای تایپ بازگشتی، به این معناست که تایپ بازگشتی تایپ مشخصی است که trait را " +"پیادهسازی میکند، بدون اینکه تایپ را نام ببرید. این میتواند زمانی مفید باشد " +"که نمیخواهید تایپ مشخص را در یک API عمومی افشا کنید." #: src/generics/impl-trait.md:40 msgid "" @@ -6271,18 +6324,29 @@ msgid "" "`let x: Vec<_> = foo.collect()` or with the turbofish, `foo.collect::" "<Vec<_>>()`." msgstr "" +"Inference در موقعیت بازگشتی دشوار است. تابعی که `impl Foo` را برمیگرداند، " +"تایپ مشخصی را که برمیگرداند انتخاب میکند، بدون اینکه آن را به طور صریح در " +"منبع بنویسد. تابعی که تایپ generic مانند `collect<B>() -> B` را برمیگرداند، " +"میتواند هر تایپ که `B` را برآورده میکند بازگرداند، و ممکن است فراخوانیکننده " +"نیاز به انتخاب یکی از آنها داشته باشد، مانند `let x: Vec<_> = foo.collect()` " +"یا با استفاده از ()<turbofish، `foo.collect::<Vec<_>`." #: src/generics/impl-trait.md:47 msgid "" "What is the type of `debuggable`? Try `let debuggable: () = ..` to see what " "the error message shows." msgstr "" +"نوع `debuggable` چیست؟ سعی کنید .. = () :let debuggable` را امتحان کنید تا " +"ببینید پیام خطا چه چیزی را نشان میدهد." #: src/generics/dyn-trait.md:3 msgid "" "In addition to using traits for static dispatch via generics, Rust also " "supports using them for type-erased, dynamic dispatch via trait objects:" msgstr "" +"علاوه بر استفاده از تریدها برای فراخوانی استاتیک از طریق genericها، Rust " +"همچنین از استفاده از آنها برای فراخوانی داینامیک با تایپهای حذفشده از طریق " +"اشیاء trait پشتیبانی میکند:" #: src/generics/dyn-trait.md:27 src/smart-pointers/trait-objects.md:28 msgid "\"Miau!\"" @@ -6310,6 +6374,11 @@ msgid "" "full type information and can resolve which type's trait implementation to " "use." msgstr "" +"Genericها، از جمله `impl Trait`، از monomorphization برای ایجاد یک نمونه " +"تخصصی از تابع برای هر تایپ مختلفی که با آن نمونهسازی شده استفاده میکنند. این " +"بدان معناست که فراخوانی یک متد trait از درون یک تابع generic همچنان از " +"فراخوانی استاتیک استفاده میکند، زیرا کامپایلر اطلاعات کامل تایپ را دارد و " +"میتواند پیادهسازی trait مربوط به تایپ را مشخص کند." #: src/generics/dyn-trait.md:62 msgid "" @@ -6318,6 +6387,11 @@ msgid "" "This means that there's a single version of `fn dynamic` that is used " "regardless of what type of `Pet` is passed in." msgstr "" +"زمانی که از `dyn Trait` استفاده میشود، بهجای آن از فراخوانی داینامیک از طریق " +"یک [virtual method table](https://en.wikipedia.org/wiki/" +"Virtual_method_table) (vtable) استفاده میکند. این بدان معناست که یک نسخه " +"واحد از `fn dynamic` وجود دارد که بدون توجه به تایپ `Pet` که وارد میشود، " +"استفاده میشود." #: src/generics/dyn-trait.md:67 msgid "" @@ -6325,6 +6399,10 @@ msgid "" "indirection. In this case it's a reference, though smart pointer types like " "`Box` can also be used (this will be demonstrated on day 3)." msgstr "" +"زمانی که از `dyn Trait` استفاده میشود، شی trait باید پشت یک تایپ واسط قرار " +"داشته باشد. در این مورد، این تایپ واسط یک ارجاع است، اگرچه تایپهای " +"اشارهگرهای هوشمند مانند `Box` نیز میتوانند استفاده شوند (این موضوع در روز " +"سوم نشان داده خواهد شد)." #: src/generics/dyn-trait.md:71 msgid "" @@ -6337,12 +6415,21 @@ msgid "" "compiler doesn't need to know the concrete type of the `Pet` in order to do " "this." msgstr "" +"در زمان اجرا، یک `dyn Pet&` بهصورت یک \"اشارهگر چاق\" (fat pointer) نمایان " +"میشود، یعنی یک جفت از دو اشارهگر: یکی از اشارهگرها به شیء مشخصی که `Pet` را " +"پیادهسازی میکند اشاره دارد و دیگری به vtable برای پیادهسازی ترید آن نوع " +"اشاره میکند. هنگام فراخوانی متد `talk` بر روی `dyn Pet&`، کامپایلر آدرس تابع " +"`talk` را در vtable جستجو کرده و سپس تابع را فراخوانی میکند و اشارهگر به " +"`Dog` یا `Cat` را به آن تابع پاس میدهد. کامپایلر نیازی به دانستن تایپ مشخص " +"`Pet` برای انجام این کار ندارد." #: src/generics/dyn-trait.md:79 msgid "" "A `dyn Trait` is considered to be \"type-erased\", because we no longer have " "compile-time knowledge of what the concrete type is." msgstr "" +"یک `dyn Trait` بهعنوان \"تایپ حذف شده\" (type-erased) در نظر گرفته میشود، " +"زیرا دیگر در زمان کامپایل اطلاعاتی درباره تایپ مشخص نداریم." #: src/generics/exercise.md:3 msgid "" @@ -6350,6 +6437,9 @@ msgid "" "determines the minimum of two values, using the [`Ord`](https://doc.rust-" "lang.org/stable/std/cmp/trait.Ord.html) trait." msgstr "" +"در این تمرین کوتاه، شما یک تابع `min`generic را پیادهسازی خواهید کرد که " +"حداقل از دو مقدار را تعیین میکند، با استفاده از trait [`Ord`](https://doc." +"rust-lang.org/stable/std/cmp/trait.Ord.html)." #: src/generics/exercise.md:8 msgid "// TODO: implement the `min` function used in `main`.\n" @@ -6387,15 +6477,17 @@ msgid "" "html) trait and [`Ordering`](https://doc.rust-lang.org/stable/std/cmp/enum." "Ordering.html) enum." msgstr "" +"[`Ord`](https://doc.rust-lang.org/stable/std/cmp/trait.Ord.html) trait و " +"[`Ordering`](https://doc.rust-lang.org/stable/std/cmp/enum.Ordering.html) " +"enum را به دانشآموزان نشان دهید." #: src/std-types.md src/std-types/option.md:1 -#, fuzzy msgid "Option" -msgstr "استثناها" +msgstr "Option" #: src/std-types.md src/std-types/result.md:1 src/error-handling.md msgid "Result" -msgstr "" +msgstr "Result" #: src/std-types.md src/std-types/string.md:1 msgid "String" @@ -6414,6 +6506,8 @@ msgid "" "For each of the slides in this section, spend some time reviewing the " "documentation pages, highlighting some of the more common methods." msgstr "" +"برای هر یک از اسلایدهای این بخش، کمی زمان صرف مرور صفحات مستندات کنید و برخی " +"از متدهای رایجتر را برجسته کنید." #: src/std-types/std.md:3 msgid "" @@ -6421,48 +6515,61 @@ msgid "" "types used by Rust libraries and programs. This way, two libraries can work " "together smoothly because they both use the same `String` type." msgstr "" +"Rust دارای یک کتابخانه استاندارد است که به ایجاد مجموعهای از تایپهای رایج " +"استفادهشده توسط کتابخانهها و برنامههای Rust کمک میکند. به این ترتیب، دو " +"کتابخانه میتوانند بهراحتی با هم کار کنند زیرا هر دو از تایپ `String` یکسانی " +"استفاده میکنند." #: src/std-types/std.md:7 msgid "" "In fact, Rust contains several layers of the Standard Library: `core`, " "`alloc` and `std`." msgstr "" +"در واقع، Rust شامل چندین لایه از کتابخانه استاندارد است: `core`، `alloc` و " +"`std`." #: src/std-types/std.md:10 msgid "" "`core` includes the most basic types and functions that don't depend on " "`libc`, allocator or even the presence of an operating system." msgstr "" +"`core` شامل ابتداییترین تایپها و توابع است که به `libc`، تخصیصدهنده حافظه یا " +"حتی وجود یک سیستمعامل وابسته نیستند." #: src/std-types/std.md:12 msgid "" "`alloc` includes types which require a global heap allocator, such as `Vec`, " "`Box` and `Arc`." msgstr "" +"`alloc` شامل تایپهایی است که به یک تخصیصدهنده حافظه سراسری نیاز دارند، مانند " +"`Vec`، `Box` و `Arc`." #: src/std-types/std.md:14 msgid "" "Embedded Rust applications often only use `core`, and sometimes `alloc`." msgstr "" +"برنامههای Rust تعبیهشده اغلب تنها از `core` و گاهی اوقات از `alloc` استفاده " +"میکنند." #: src/std-types/docs.md:3 msgid "Rust comes with extensive documentation. For example:" -msgstr "" +msgstr "Rust دارای مستندات گستردهای است. به عنوان مثال:" #: src/std-types/docs.md:5 -#, fuzzy msgid "" "All of the details about [loops](https://doc.rust-lang.org/stable/reference/" "expressions/loop-expr.html)." msgstr "" -"اگر میخواهید زودتر از یک حلقه خارج شوید، از [`break`](https://doc.rust-lang." -"org/reference/expressions/loop-expr.html#break-expressions) استفاده کنید," +"تمام جزئیات مربوط به [حلقهها](https://doc.rust-lang.org/stable/reference/" +"expressions/loop-expr.html)." #: src/std-types/docs.md:7 msgid "" "Primitive types like [`u8`](https://doc.rust-lang.org/stable/std/primitive." "u8.html)." msgstr "" +"تایپهای ابتدایی مانند [`u8`](https://doc.rust-lang.org/stable/std/primitive." +"u8.html)." #: src/std-types/docs.md:9 msgid "" @@ -6470,10 +6577,13 @@ msgid "" "option/enum.Option.html) or [`BinaryHeap`](https://doc.rust-lang.org/stable/" "std/collections/struct.BinaryHeap.html)." msgstr "" +"تایپهای کتابخانه استاندارد مانند [`Option`](https://doc.rust-lang.org/stable/" +"std/option/enum.Option.html) یا [`BinaryHeap`](https://doc.rust-lang.org/" +"stable/std/collections/struct.BinaryHeap.html)." #: src/std-types/docs.md:13 msgid "In fact, you can document your own code:" -msgstr "" +msgstr "در واقع، شما میتوانید کد خود را مستند کنید:" #: src/std-types/docs.md:16 msgid "" @@ -6484,25 +6594,25 @@ msgid "" msgstr "" #: src/std-types/docs.md:27 -#, fuzzy msgid "" "The contents are treated as Markdown. All published Rust library crates are " "automatically documented at [`docs.rs`](https://docs.rs) using the [rustdoc]" "(https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) tool. It is " "idiomatic to document all public items in an API using this pattern." msgstr "" -"محتوا کامنت شده به عنوان `Markdown` در نظر گرفته میشود. تمام جعبههایی " -"(Crate) که در راست منتشر میشوند بهطور خودکار با استفاده از ابزار [rustdoc]" -"(https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) در [`docs.rs`]" -"(https://docs.rs) مستند میشوند. این یک سبک رایج است که تمام آیتمهای عمومی در " -"یک API با استفاده از این الگو مستند شود. همچنین میتوان قطعه کدهایی شامل نحوه " -"استفاده را مستند کرد و به عنوان تستهای واحد (unit tests) استفاده خواهند شد." +"محتویات بهعنوان Markdown پردازش میشوند. تمام crateهای کتابخانهای منتشرشده " +"Rust بهطور خودکار در [`docs.rs`](https://docs.rs) با استفاده از ابزار " +"[rustdoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) مستند " +"میشوند. مستند کردن تمام آیتمهای عمومی در یک API با استفاده از این الگو بهطور " +"رایج مرسوم است." #: src/std-types/docs.md:32 msgid "" "To document an item from inside the item (such as inside a module), use `//!" "` or `/*! .. */`, called \"inner doc comments\":" msgstr "" +"برای مستند کردن یک آیتم از درون خود آیتم (مانند درون یک ماژول)، از `!//` یا " +"`/* .. !*/` استفاده کنید که به آن \"کامنتهای مستندات داخلی\" میگویند:" #: src/std-types/docs.md:36 msgid "" @@ -6511,13 +6621,12 @@ msgid "" msgstr "" #: src/std-types/docs.md:42 -#, fuzzy msgid "" "Show students the generated docs for the `rand` crate at <https://docs.rs/" "rand>." msgstr "" -"دانشجویان را با مستندات تولید شده برای جعبه `rand` در [`docs.rs/rand`]" -"(https://docs.rs/rand) آشنا کنید." +"مستندات تولیدشده برای `rand` crate را در <https://docs.rs/rand> به " +"دانشآموزان نشان دهید." #: src/std-types/option.md:3 msgid "" @@ -6525,6 +6634,10 @@ msgid "" "type `T` or nothing. For example, [`String::find`](https://doc.rust-lang.org/" "stable/std/string/struct.String.html#method.find) returns an `Option<usize>`." msgstr "" +"ما قبلاً برخی استفادهها از `<Option<T` را مشاهده کردهایم. این تایپ یا مقداری " +"از تایپ`T` را ذخیره میکند یا هیچ چیزی را ذخیره نمیکند. به عنوان مثال، " +"[`String::find`](https://doc.rust-lang.org/stable/std/string/struct.String." +"html#method.find) یک `<Option<usize` را برمیگرداند." #: src/std-types/option.md:10 msgid "\"Löwe 老虎 Léopard Gepardi\"" @@ -6549,30 +6662,40 @@ msgstr "" #: src/std-types/option.md:23 msgid "`Option` is widely used, not just in the standard library." msgstr "" +"`Option` بهطور گستردهای استفاده میشود و تنها در کتابخانه استاندارد محدود " +"نمیشود." #: src/std-types/option.md:24 msgid "" "`unwrap` will return the value in an `Option`, or panic. `expect` is similar " "but takes an error message." msgstr "" +"`unwrap` مقدار موجود در یک `Option` را برمیگرداند یا باعث panic میشود. " +"`expect` مشابه است اما پیامی برای خطا میپذیرد." #: src/std-types/option.md:26 msgid "" "You can panic on None, but you can't \"accidentally\" forget to check for " "None." msgstr "" +"میتوانید در مواجهه با panic `None` کنید، اما نمیتوانید بهطور \"تصادفی\" " +"فراموش کنید که `None` بررسی کنید." #: src/std-types/option.md:28 msgid "" "It's common to `unwrap`/`expect` all over the place when hacking something " "together, but production code typically handles `None` in a nicer fashion." msgstr "" +"استفاده از `unwrap`/`expect` در همهجا هنگام ساخت سریع چیزی رایج است، اما کد " +"تولیدی معمولاً `None` را بهشیوهای مناسبتر مدیریت میکند." #: src/std-types/option.md:30 msgid "" "The niche optimization means that `Option<T>` often has the same size in " "memory as `T`." msgstr "" +"بهینهسازی niche به این معناست که `<Option<T` اغلب اندازهای مشابه با `T` در " +"حافظه دارد." #: src/std-types/result.md:3 msgid "" @@ -6580,6 +6703,9 @@ msgid "" "operation, each with a different enum variant. It is generic: `Result<T, E>` " "where `T` is used in the `Ok` variant and `E` appears in the `Err` variant." msgstr "" +"`Result` مشابه `Option` است، اما موفقیت یا شکست یک عملیات را نشان میدهد، " +"هرکدام با یک نوع متغیر enum متفاوت. این نوع جنریک است: `<Result<T, E` که در " +"آن `T` در متغیر `Ok` استفاده میشود و `E` در متغیر `Err` ظاهر میشود." #: src/std-types/result.md:12 src/error-handling/result.md:11 msgid "\"diary.txt\"" @@ -6604,6 +6730,10 @@ msgid "" "case where an error should never happen, `unwrap()` or `expect()` can be " "called, and this is a signal of the developer intent too." msgstr "" +"همانند `Option`، مقدار موفقیتآمیز درون `Result` قرار دارد و توسعهدهنده را " +"ملزم به استخراج صریح آن میکند. این به بررسی خطاها تشویق میکند. در صورتی که " +"خطا هرگز نباید رخ دهد، میتوان از `()unwrap` یا `()expect` استفاده کرد که این " +"نیز نشاندهنده نیت توسعهدهنده است." #: src/std-types/result.md:36 msgid "" @@ -6611,18 +6741,25 @@ msgid "" "is worth mentioning. It contains a lot of convenience methods and functions " "that help functional-style programming." msgstr "" +"مستندات `Result` مطالعهای توصیهشده است. نه در طول دوره، اما ذکر آن ارزشمند " +"است. این مستندات شامل بسیاری از متدها و توابع کاربردی است که به برنامهنویسی " +"به استایل تابعمحور کمک میکند." #: src/std-types/result.md:39 msgid "" "`Result` is the standard type to implement error handling as we will see on " "Day 4." msgstr "" +"`Result` نوع استاندارد برای پیادهسازی مدیریت خطاها است که در روز چهارم دوره " +"خواهیم دید." #: src/std-types/string.md:3 msgid "" "[`String`](https://doc.rust-lang.org/std/string/struct.String.html) is a " "growable UTF-8 encoded string:" msgstr "" +"[`String`](https://doc.rust-lang.org/std/string/struct.String.html) یک رشته " +"قابل رشد با کدگذاری UTF-8 است:" #: src/std-types/string.md:8 src/std-traits/read-and-write.md:35 #: src/memory-management/review.md:23 src/memory-management/review.md:58 @@ -6657,18 +6794,25 @@ msgid "" "string/struct.String.html#deref-methods-str), which means that you can call " "all `str` methods on a `String`." msgstr "" +"`String` پیادهسازیکننده [`Deref<Target = str>`](https://doc.rust-lang.org/" +"std/string/struct.String.html#deref-methods-str) است، که به این معناست که " +"میتوانید تمام متدهای `str` را بر روی `String` فراخوانی کنید." #: src/std-types/string.md:30 msgid "" "`String::new` returns a new empty string, use `String::with_capacity` when " "you know how much data you want to push to the string." msgstr "" +"`String::new` یک رشته جدید خالی برمیگرداند. از `String::with_capacity` " +"استفاده کنید زمانی که میدانید چقدر داده میخواهید به رشته اضافه کنید." #: src/std-types/string.md:32 msgid "" "`String::len` returns the size of the `String` in bytes (which can be " "different from its length in characters)." msgstr "" +"`String::len` اندازه رشته `String` را بهصورت بایت برمیگرداند (که ممکن است با " +"طول آن بهصورت کاراکتر متفاوت باشد)." #: src/std-types/string.md:34 msgid "" @@ -6677,57 +6821,74 @@ msgid "" "to [grapheme clusters](https://docs.rs/unicode-segmentation/latest/" "unicode_segmentation/struct.Graphemes.html)." msgstr "" +"`String::chars` یک تکرارگر (iterator) از روی کاراکترهای واقعی برمیگرداند. " +"توجه داشته باشید که یک `char` ممکن است با آنچه که یک انسان به عنوان " +"\"کاراکتر\" در نظر میگیرد، متفاوت باشد به دلیل [grapheme clusters](https://" +"docs.rs/unicode-segmentation/latest/unicode_segmentation/struct.Graphemes." +"html)." #: src/std-types/string.md:37 msgid "" "When people refer to strings they could either be talking about `&str` or " "`String`." msgstr "" +"زمانی که مردم به رشتهها اشاره میکنند، ممکن است منظورشان `str&` یا `String` " +"باشد." #: src/std-types/string.md:39 msgid "" "When a type implements `Deref<Target = T>`, the compiler will let you " "transparently call methods from `T`." msgstr "" +"زمانی که یک تایپ، `<Deref<Target = T` را پیادهسازی میکند، کامپایلر به شما " +"این امکان را میدهد که بهطور شفاف متدهای `T` را فراخوانی کنید." #: src/std-types/string.md:41 msgid "" "We haven't discussed the `Deref` trait yet, so at this point this mostly " "explains the structure of the sidebar in the documentation." msgstr "" +"ما هنوز `Deref` trait را بررسی نکردهایم، بنابراین در این مرحله این بیشتر " +"توضیحدهنده ساختار نوار کناری در مستندات است." #: src/std-types/string.md:43 msgid "" "`String` implements `Deref<Target = str>` which transparently gives it " "access to `str`'s methods." msgstr "" +"`String` پیادهسازیکننده `<Deref<Target = str` است که بهطور شفاف دسترسی به " +"متدهای `str` را فراهم میکند." #: src/std-types/string.md:45 msgid "Write and compare `let s3 = s1.deref();` and `let s3 = &*s1;`." -msgstr "" +msgstr "`;()let s3 = s1.deref` و `;let s3 = &*s1` بنویسید و مقایسه کنید ." #: src/std-types/string.md:46 msgid "" "`String` is implemented as a wrapper around a vector of bytes, many of the " "operations you see supported on vectors are also supported on `String`, but " "with some extra guarantees." -msgstr "" +msgstr "بنویسید و مقایسه کنید `let s3 = s1.deref();` و `let s3 = &*s1;`." #: src/std-types/string.md:49 msgid "Compare the different ways to index a `String`:" -msgstr "" +msgstr "راههای مختلف برای ایندکسگذاری یک `String` را مقایسه کنید:" #: src/std-types/string.md:50 msgid "" "To a character by using `s3.chars().nth(i).unwrap()` where `i` is in-bound, " "out-of-bounds." msgstr "" +"به یک کاراکتر با استفاده از `()s3.chars().nth(i).unwrap`، جایی که `i` در " +"محدوده است یا خارج از محدوده." #: src/std-types/string.md:52 msgid "" "To a substring by using `s3[0..4]`, where that slice is on character " "boundaries or not." msgstr "" +"به یک زیررشته با استفاده از `[4..0]s3`، جایی که این برش در مرزهای کاراکترها " +"است یا نباشد." #: src/std-types/string.md:54 msgid "" @@ -6737,12 +6898,19 @@ msgid "" "`Display`, so anything that can be formatted can also be converted to a " "string." msgstr "" +"بسیاری از تایپ دادهها میتوانند با استفاده از متد [`to_string`](https://doc." +"rust-lang.org/std/string/trait.ToString.html#tymethod.to_string) به رشته " +"تبدیل شوند. این ترید بهطور خودکار برای تمام تایپهایی که `Display` را " +"پیادهسازی میکنند، پیادهسازی شده است، بنابراین هر چیزی که میتواند قالببندی " +"شود، همچنین میتواند به رشته تبدیل شود." #: src/std-types/vec.md:3 msgid "" "[`Vec`](https://doc.rust-lang.org/std/vec/struct.Vec.html) is the standard " "resizable heap-allocated buffer:" msgstr "" +"[`Vec`](https://doc.rust-lang.org/std/vec/struct.Vec.html) بافر قابل تغییر " +"اندازه و heap-allocated است." #: src/std-types/vec.md:9 msgid "\"v1: len = {}, capacity = {}\"" @@ -6774,6 +6942,9 @@ msgid "" "struct.Vec.html#deref-methods-%5BT%5D), which means that you can call slice " "methods on a `Vec`." msgstr "" +"`Vec` پیادهسازیکننده [`Deref<Target = [T]>`](https://doc.rust-lang.org/std/" +"vec/struct.Vec.html#deref-methods-%5BT%5D) است، به این معنی که میتوانید " +"متدهای برش را بر روی یک `Vec` فراخوانی کنید." #: src/std-types/vec.md:38 msgid "" @@ -6781,6 +6952,9 @@ msgid "" "it contains is stored on the heap. This means the amount of data doesn't " "need to be known at compile time. It can grow or shrink at runtime." msgstr "" +"`Vec` نوعی مجموعه است، به همراه `String` و `HashMap`. دادههای آن در حافظه " +"heap ذخیره میشود. به این معنی که مقدار دادهها نیازی به دانستن در زمان " +"کامپایل ندارد و میتواند در زمان اجرا رشد یا کوچک شود." #: src/std-types/vec.md:41 msgid "" @@ -6788,12 +6962,17 @@ msgid "" "explicitly. As always with Rust type inference, the `T` was established " "during the first `push` call." msgstr "" +"توجه داشته باشید که `<Vec<T` نیز یک تایپ generic است، اما نیازی به تعیین " +"صریح `T` ندارید. همانطور که همیشه با استنتاج تایپ در Rust ، `T` در زمان " +"اولین فراخوانی `push` مشخص شده است." #: src/std-types/vec.md:44 msgid "" "`vec![...]` is a canonical macro to use instead of `Vec::new()` and it " "supports adding initial elements to the vector." msgstr "" +"`[...]!vec` یک ماکرو استاندارد برای استفاده بهجای `()Vec::new` است و از " +"افزودن عناصر اولیه به vector پشتیبانی میکند." #: src/std-types/vec.md:46 msgid "" @@ -6801,16 +6980,21 @@ msgid "" "Alternatively, using `get` will return an `Option`. The `pop` function will " "remove the last element." msgstr "" +"برای ایندکسگذاری vector از `[` `]` استفاده میکنید، اما اگر از محدوده خارج " +"شود، باعث panic میشود. بهطور جایگزین، استفاده از `get` یک `Option` را " +"برمیگرداند. تابع `pop` آخرین عنصر را حذف میکند." #: src/std-types/vec.md:49 msgid "" "Slices are covered on day 3. For now, students only need to know that a " "value of type `Vec` gives access to all of the documented slice methods, too." msgstr "" +"برشها در روز سوم پوشش داده میشوند. در حال حاضر، دانشآموزان تنها باید بدانند " +"که یک مقدار از تایپ `Vec` به تمام متدهای مستند شده برشها نیز دسترسی دارد." #: src/std-types/hashmap.md:3 msgid "Standard hash map with protection against HashDoS attacks:" -msgstr "" +msgstr "نقشه hash استاندارد با حفاظت در برابر حملات HashDoS:" #: src/std-types/hashmap.md:10 msgid "\"Adventures of Huckleberry Finn\"" @@ -6856,7 +7040,7 @@ msgstr "" #: src/std-types/hashmap.md:41 msgid "" "`HashMap` is not defined in the prelude and needs to be brought into scope." -msgstr "" +msgstr "`HashMap` در prelude تعریف نشده و باید به scope وارد شود." #: src/std-types/hashmap.md:42 msgid "" @@ -6864,6 +7048,9 @@ msgid "" "hashmap and if not return an alternative value. The second line will insert " "the alternative value in the hashmap if the book is not found." msgstr "" +"سطرهای کد زیر را امتحان کنید. سطر اول بررسی میکند که آیا یک کتاب در " +"`HashMap` وجود دارد یا خیر و اگر وجود نداشت، یک مقدار جایگزین برمیگرداند. " +"سطر دوم مقدار جایگزین را در `HashMap` وارد میکند اگر کتاب پیدا نشد." #: src/std-types/hashmap.md:48 src/std-types/hashmap.md:60 msgid "\"Harry Potter and the Sorcerer's Stone\"" @@ -6875,7 +7062,7 @@ msgstr "" #: src/std-types/hashmap.md:54 msgid "Unlike `vec!`, there is unfortunately no standard `hashmap!` macro." -msgstr "" +msgstr "برخلاف `!vec`، متأسفانه ماکروی استاندارد `!hashmap` وجود ندارد." #: src/std-types/hashmap.md:55 msgid "" @@ -6884,12 +7071,18 @@ msgid "" "From%3C%5B(K,+V);+N%5D%3E-for-HashMap%3CK,+V,+RandomState%3E), which allows " "us to easily initialize a hash map from a literal array:" msgstr "" +"از نسخه 1.56 Rust به بعد، `HashMap` پیادهسازیکننده [`From<[(K, V); N]>`]" +"(https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#impl-" +"From%3C%5B(K,+V);+N%5D%3E-for-HashMap%3CK,+V,+RandomState%3E) است که به ما " +"اجازه میدهد بهراحتی یک `HashMap` را از یک آرایه مقداردهی اولیه کنیم:" #: src/std-types/hashmap.md:65 msgid "" "Alternatively HashMap can be built from any `Iterator` which yields key-" "value tuples." msgstr "" +"بهطور جایگزین، `HashMap` میتواند از هر `Iterator` که جفتهای key-value را " +"تولید میکند، ساخته شود." #: src/std-types/hashmap.md:67 msgid "" @@ -6897,12 +7090,17 @@ msgid "" "examples easier. Using references in collections can, of course, be done, " "but it can lead into complications with the borrow checker." msgstr "" +"ما `<HashMap<String, i32` را نمایش میدهیم و از استفاده از `str&` بهعنوان " +"کلید اجتناب میکنیم تا مثالها سادهتر شوند. استفاده از ارجاعات در مجموعهها " +"البته ممکن است، اما میتواند به مشکلاتی با borrow checker منجر شود." #: src/std-types/hashmap.md:70 msgid "" "Try removing `to_string()` from the example above and see if it still " "compiles. Where do you think we might run into issues?" msgstr "" +"حذف `()to_string` از مثال بالا را امتحان کنید و ببینید آیا هنوز کامپایل " +"میشود یا خیر. فکر میکنید ممکن است با چه مشکلاتی مواجه شویم؟" #: src/std-types/hashmap.md:73 msgid "" @@ -6911,6 +7109,10 @@ msgid "" "Rust docs. Show students the docs for this type, and the helpful link back " "to the `keys` method." msgstr "" +"این چندین تایپ \"تایپ بازگشتی خاص متد\" دارد، مانند `std::collections::" +"hash_map::Keys`. این تایپها معمولاً در جستجوهای مستندات Rust ظاهر میشوند. " +"مستندات این تایپ را به دانشآموزان نشان دهید و پیوند مفید بازگشتی به متد " +"`keys` را نیز نمایش دهید." #: src/std-types/exercise.md:3 msgid "" @@ -6919,6 +7121,10 @@ msgid "" "stable/std/collections/struct.HashMap.html) to keep track of which values " "have been seen and how many times each one has appeared." msgstr "" +"در این تمرین، شما یک ساختار داده بسیار ساده را بهصورت generic خواهید کرد. " +"این ساختار از [`std::collections::HashMap`](https://doc.rust-lang.org/stable/" +"std/collections/struct.HashMap.html) برای پیگیری اینکه چه مقادیری مشاهده " +"شدهاند و هرکدام چند بار ظاهر شدهاند، استفاده میکند." #: src/std-types/exercise.md:9 msgid "" @@ -6926,6 +7132,9 @@ msgid "" "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` بهطور سختافزاری برای مقادیر `u32` کدگذاری شده است. " +"ساختار و متدهای آن را بهصورت generic بر اساس تایپ مقداری که در حال پیگیری " +"است، تغییر دهید، بهطوری که `Counter` بتواند هر تایپ مقداری را پیگیری کند." #: src/std-types/exercise.md:13 msgid "" @@ -6933,6 +7142,9 @@ msgid "" "stable/std/collections/struct.HashMap.html#method.entry) method to halve the " "number of hash lookups required to implement the `count` method." msgstr "" +"اگر زود تمام کردید، سعی کنید از متد [`entry`](https://doc.rust-lang.org/" +"stable/std/collections/struct.HashMap.html#method.entry) استفاده کنید تا " +"تعداد جستجوهای هش مورد نیاز برای پیادهسازی متد `count` را به نصف کاهش دهید." #: src/std-types/exercise.md:20 src/std-types/solution.md:6 msgid "" @@ -6973,15 +7185,15 @@ msgstr "" #: src/concurrency/async-exercises.md msgid "This segment should take about 1 hour and 10 minutes. It contains:" msgstr "" +"این بخش باید حدود ۱ ساعت و ۱۰ دقیقه طول بکشد. این بخش شامل موارد زیر است:" #: src/std-traits.md msgid "From and Into" -msgstr "From و Into" +msgstr "From and Into" #: src/std-traits.md -#, fuzzy msgid "Read and Write" -msgstr "متد ها و صفات" +msgstr "Read and Write" #: src/std-traits.md msgid "Default, struct update syntax" @@ -6992,26 +7204,33 @@ msgid "" "As with the standard-library types, spend time reviewing the documentation " "for each trait." msgstr "" +"همانند تایپها موجود در کتابخانه استاندارد، زمانی را صرف مرور مستندات هرtrait " +"کنید." #: src/std-traits.md msgid "This section is long. Take a break midway through." -msgstr "" +msgstr "این بخش طولانی است. در میانهی آن یک استراحت کنید." #: src/std-traits/comparisons.md:3 msgid "" "These traits support comparisons between values. All traits can be derived " "for types containing fields that implement these traits." msgstr "" +"این traitها از مقایسه بین مقادیر پشتیبانی میکنند. همهی این traitها را میتوان " +"برای تایپهایی که شامل فیلدهایی هستند که این traitها را پیادهسازی میکنند، " +"بهدست آورد." #: src/std-traits/comparisons.md:6 msgid "`PartialEq` and `Eq`" -msgstr "" +msgstr "`PartialEq` and `Eq`" #: src/std-traits/comparisons.md:8 msgid "" "`PartialEq` is a partial equivalence relation, with required method `eq` and " "provided method `ne`. The `==` and `!=` operators will call these methods." msgstr "" +"`PartialEq` یک رابطه همارزی جزئی است که دارای متد الزامی `eq` و متد ارائهشده " +"`ne` میباشد. عملگرهای `==` و `=!` این متدها را فراخوانی میکنند." #: src/std-traits/comparisons.md:23 msgid "" @@ -7019,51 +7238,65 @@ msgid "" "and implies `PartialEq`. Functions that require full equivalence will use " "`Eq` as a trait bound." msgstr "" +"`Eq` یک رابطه همارزی کامل است (بازتابی، متقارن، و transitive) و شامل " +"`PartialEq` میشود. توابعی که به همارزی کامل نیاز دارند، از `Eq` بهعنوان یک " +"trait bound استفاده میکنند." #: src/std-traits/comparisons.md:27 msgid "`PartialOrd` and `Ord`" -msgstr "" +msgstr "`PartialOrd` and `Ord`" #: src/std-traits/comparisons.md:29 msgid "" "`PartialOrd` defines a partial ordering, with a `partial_cmp` method. It is " "used to implement the `<`, `<=`, `>=`, and `>` operators." msgstr "" +"`PartialOrd` یک ترتیب جزئی را تعریف میکند و دارای متد `partial_cmp` است. این " +"ویژگی برای پیادهسازی عملگرهای `<`، `<=`، `>=` و `>` استفاده میشود." #: src/std-traits/comparisons.md:49 msgid "`Ord` is a total ordering, with `cmp` returning `Ordering`." msgstr "" +"`Ord` یک ترتیب کامل است که در آن متد `cmp` مقدار `Ordering` را برمیگرداند." #: src/std-traits/comparisons.md:54 msgid "" "`PartialEq` can be implemented between different types, but `Eq` cannot, " "because it is reflexive:" msgstr "" +"`PartialEq` میتواند بین تایپهای مختلف پیادهسازی شود، اما `Eq` نمیتواند، زیرا " +"بازتابی است:" #: src/std-traits/comparisons.md:69 msgid "" "In practice, it's common to derive these traits, but uncommon to implement " "them." msgstr "" +"در عمل، معمولاً این traitها بهطور خودکار بهدست میآیند، اما کمتر پیش میآید که " +"آنها بهطور دستی پیادهسازی شوند." #: src/std-traits/operators.md:3 msgid "" "Operator overloading is implemented via traits in [`std::ops`](https://doc." "rust-lang.org/std/ops/index.html):" msgstr "" +"بارگذاری مجدد عملگرها از طریق traits در [`std::ops`](https://doc.rust-lang." +"org/std/ops/index.html) پیادهسازی شده است:" #: src/std-traits/operators.md:23 msgid "\"{:?} + {:?} = {:?}\"" -msgstr "" +msgstr "\"{:?} + {:?} = {:?}\"" #: src/std-traits/operators.md:30 src/memory-management/drop.md:48 msgid "Discussion points:" -msgstr "" +msgstr "نکات بحث:" #: src/std-traits/operators.md:32 msgid "" "You could implement `Add` for `&Point`. In which situations is that useful?" msgstr "" +"میتوانید `Add` را برای `Point&` پیادهسازی کنید. در چه موقعیتهایی این کار " +"مفید است؟" #: src/std-traits/operators.md:33 msgid "" @@ -7071,12 +7304,17 @@ msgid "" "the operator is not `Copy`, you should consider overloading the operator for " "`&T` as well. This avoids unnecessary cloning on the call site." msgstr "" +"پاسخ: `Add:add` خود `self` را مصرف میکند. اگر تایپ `T` که برای آن عملگر را " +"بارگذاری میکنید، `Copy` نباشد، باید پیادهسازی عملگر را برای `T&` نیز در نظر " +"بگیرید. این کار از ایجاد کپیهای غیرضروری در محل فراخوانی جلوگیری میکند." #: src/std-traits/operators.md:36 msgid "" "Why is `Output` an associated type? Could it be made a type parameter of the " "method?" msgstr "" +"چرا `Output` یک تایپ مرتبط است؟ آیا میتوان آن را بهعنوان یک پارامترتایپ برای " +"متد تعریف کرد؟" #: src/std-traits/operators.md:38 msgid "" @@ -7084,12 +7322,16 @@ msgid "" "associated types (like `Output`) are controlled by the implementer of a " "trait." msgstr "" +"پاسخ کوتاه: پارامترهای تایپ تابع توسط فراخوانیکننده کنترل میشوند، اما " +"تایپهای مرتبط (مانند `Output`) توسط پیادهساز trait کنترل میشوند." #: src/std-traits/operators.md:41 msgid "" "You could implement `Add` for two different types, e.g. `impl Add<(i32, " "i32)> for Point` would add a tuple to a `Point`." msgstr "" +"شما میتوانید `Add` را برای دو تایپ مختلف پیادهسازی کنید، بهعنوان مثال `impl " +"Add<(i32, i32)> for Point` میتواند یک tuple را به یک `Point` اضافه کند." #: src/std-traits/from-and-into.md:3 msgid "" @@ -7097,10 +7339,13 @@ msgid "" "html) and [`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) to " "facilitate type conversions:" msgstr "" +"تایپهای مختلف ویژگیهای [`From`](https://doc.rust-lang.org/std/convert/trait." +"From.html) و [`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) " +"را برای تسهیل تبدیل تایپ پیادهسازی میکنند:" #: src/std-traits/from-and-into.md:11 src/std-traits/from-and-into.md:23 msgid "\"{s}, {addr}, {one}, {bigger}\"" -msgstr "" +msgstr "\"{s}, {addr}, {one}, {bigger}\"" #: src/std-traits/from-and-into.md:15 msgid "" @@ -7108,12 +7353,17 @@ msgid "" "automatically implemented when [`From`](https://doc.rust-lang.org/std/" "convert/trait.From.html) is implemented:" msgstr "" +"[`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) بهطور خودکار " +"زمانی پیادهسازی میشود که [`From`](https://doc.rust-lang.org/std/convert/" +"trait.From.html) پیادهسازی شده باشد:" #: src/std-traits/from-and-into.md:30 msgid "" "That's why it is common to only implement `From`, as your type will get " "`Into` implementation too." msgstr "" +"به همین دلیل معمولاً تنها `From` پیادهسازی میشود، زیرا تایپ شما بهطور خودکار " +"پیادهسازی `Into` را نیز دریافت میکند." #: src/std-traits/from-and-into.md:32 msgid "" @@ -7122,24 +7372,30 @@ msgid "" "Your function will accept types that implement `From` and those that _only_ " "implement `Into`." msgstr "" +"هنگام اعلام تایپ ورودی تابعی مانند \"هر چیزی که میتواند به یک `String` تبدیل " +"شود\"، قاعده برعکس است، باید از `Into` استفاده کنید. تابع شما تایپهای را " +"قبول میکند که پیادهسازی `From` دارند و همچنین تایدهایی که فقط `Into` را " +"پیادهسازی کردهاند." #: src/std-traits/casting.md:3 msgid "" "Rust has no _implicit_ type conversions, but does support explicit casts " "with `as`. These generally follow C semantics where those are defined." msgstr "" +"Rust هیچ _implicit_ ندارد، اما از تبدیلهای صریح با استفاده از `as` پشتیبانی " +"میکند. این تبدیلها معمولاً پیرو معنای C هستند که در آنجا تعریف شدهاند." #: src/std-traits/casting.md:9 msgid "\"as u16: {}\"" -msgstr "" +msgstr "\"as u16: {}\"" #: src/std-traits/casting.md:10 msgid "\"as i16: {}\"" -msgstr "" +msgstr "\"as i16: {}\"" #: src/std-traits/casting.md:11 msgid "\"as u8: {}\"" -msgstr "" +msgstr "\"as u8: {}\"" #: src/std-traits/casting.md:15 msgid "" @@ -7147,6 +7403,9 @@ msgid "" "platforms. This might not match your intuition for changing sign or casting " "to a smaller type -- check the docs, and comment for clarity." msgstr "" +"نتایج استفاده از `as` _همیشه_ در Rust تعریف شده و در تمامی پلتفرمها ثابت " +"هستند. این ممکن است با شهود شما برای تغییر علامت یا تبدیل به تایپ کوچکتر " +"مطابقت نداشته باشد -- مستندات را بررسی کنید و برای وضوح بیشتر نظر دهید." #: src/std-traits/casting.md:19 msgid "" @@ -7157,6 +7416,12 @@ msgid "" "selecting the bottom 32 bits of a `u64` with `as u32`, regardless of what " "was in the high bits)." msgstr "" +"تبدیل تایپ با استفاده از `as` ابزاری نسبتاً حساس است که استفاده نادرست از آن " +"آسان است و میتواند منبعی از اشکالات ظریف باشد، به خصوص زمانی که کار نگهداری " +"آینده باعث تغییر تایپهای مورد استفاده یا دامنه مقادیر در تایپها شود. تبدیلها " +"بهتر است تنها زمانی استفاده شوند که قصد شما نشان دادن برش بدون قید و شرط " +"باشد (مثلاً انتخاب 32 بیت پایین از یک `u64` با `as u32`، بدون توجه به آنچه در " +"بیتهای بالا وجود دارد)." #: src/std-traits/casting.md:25 msgid "" @@ -7165,10 +7430,15 @@ msgid "" "casts, `TryFrom` and `TryInto` are available when you want to handle casts " "that fit differently from those that don't." msgstr "" +"برای تبدیلهای بدون خطا (مانند تبدیل `u32` به `u64`)، استفاده از `From` یا " +"`Into` بر `as` ارجح است تا تأیید شود که تبدیل در واقع بدون خطا است. برای " +"تبدیلهای با احتمال خطا، `TryFrom` و `TryInto` در دسترس هستند وقتی که " +"میخواهید تبدیلهایی را که به شیوهای متفاوت از آنهایی که مطابقت ندارند، مدیریت " +"کنید." #: src/std-traits/casting.md:33 msgid "Consider taking a break after this slide." -msgstr "" +msgstr "در نظر داشته باشید که پس از این اسلاید استراحت کنید." #: src/std-traits/casting.md:35 msgid "" @@ -7176,10 +7446,15 @@ msgid "" "be lost is generally discouraged, or at least deserves an explanatory " "comment." msgstr "" +"`as` مشابه به `static_cast` در ++C است. استفاده از `as` در مواردی که ممکن " +"است دادهها از دست برود، معمولاً توصیه نمیشود یا حداقل نیاز به توضیحی کامنتی " +"دارد." #: src/std-traits/casting.md:38 msgid "This is common in casting integers to `usize` for use as an index." msgstr "" +"این موضوع در تبدیل اعداد صحیح به `usize` برای استفاده به عنوان ایندکس رایج " +"است." #: src/std-traits/read-and-write.md:3 msgid "" @@ -7187,94 +7462,111 @@ msgid "" "[`BufRead`](https://doc.rust-lang.org/std/io/trait.BufRead.html), you can " "abstract over `u8` sources:" msgstr "" +"با استفاده از [`Read`](https://doc.rust-lang.org/std/io/trait.Read.html) و " +"[`BufRead`](https://doc.rust-lang.org/std/io/trait.BufRead.html)، میتوانید " +"بر روی منابع `u8` انتزاع کنید:" #: src/std-traits/read-and-write.md:14 msgid "b\"foo\\nbar\\nbaz\\n\"" -msgstr "" +msgstr "b\"foo\\nbar\\nbaz\\n\"" #: src/std-traits/read-and-write.md:15 msgid "\"lines in slice: {}\"" -msgstr "" +msgstr "\"lines in slice: {}\"" #: src/std-traits/read-and-write.md:18 msgid "\"lines in file: {}\"" -msgstr "" +msgstr "\"lines in file: {}\"" #: src/std-traits/read-and-write.md:23 msgid "" "Similarly, [`Write`](https://doc.rust-lang.org/std/io/trait.Write.html) lets " "you abstract over `u8` sinks:" msgstr "" +"به طور مشابه، [`Write`](https://doc.rust-lang.org/std/io/trait.Write.html) " +"به شما امکان میدهد که بر روی منابع `u8` انتزاع کنید:" #: src/std-traits/read-and-write.md:30 msgid "\"\\n\"" -msgstr "" +msgstr "\"\\n\"" #: src/std-traits/read-and-write.md:37 msgid "\"Logged: {:?}\"" -msgstr "" +msgstr "\"Logged: {:?}\"" #: src/std-traits/default.md:1 msgid "The `Default` Trait" -msgstr "" +msgstr "The `Default` Trait" #: src/std-traits/default.md:3 msgid "" "[`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) trait " "produces a default value for a type." msgstr "" +"ویژگی [`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) " +"یک مقدار پیشفرض برای یک تایپ تولید میکند." #: src/std-traits/default.md:18 msgid "\"John Smith\"" -msgstr "" +msgstr "\"John Smith\"" #: src/std-traits/default.md:24 msgid "\"{default_struct:#?}\"" -msgstr "" +msgstr "\"{default_struct:#?}\"" #: src/std-traits/default.md:27 msgid "\"Y is set!\"" -msgstr "" +msgstr "\"Y is set!\"" #: src/std-traits/default.md:28 msgid "\"{almost_default_struct:#?}\"" -msgstr "" +msgstr "\"{almost_default_struct:#?}\"" #: src/std-traits/default.md:31 src/lifetimes/exercise.md:197 #: src/lifetimes/solution.md:196 msgid "\"{:#?}\"" -msgstr "" +msgstr "\"{:#?}\"" #: src/std-traits/default.md:38 msgid "" "It can be implemented directly or it can be derived via `#[derive(Default)]`." msgstr "" +"این ویژگی میتواند به طور مستقیم پیادهسازی شود یا میتواند از طریق " +"`[derive(Default)]#` به صورت خودکار تولید شود." #: src/std-traits/default.md:39 msgid "" "A derived implementation will produce a value where all fields are set to " "their default values." msgstr "" +"یک پیادهسازی خودکار، مقداری تولید میکند که در آن تمامی فیلدها به مقادیر " +"پیشفرض خود تنظیم شدهاند." #: src/std-traits/default.md:41 msgid "This means all types in the struct must implement `Default` too." msgstr "" +"این بدان معناست که تمام تایپهای موجود در ساختار نیز باید `Default` را " +"پیادهسازی کنند." #: src/std-traits/default.md:42 msgid "" "Standard Rust types often implement `Default` with reasonable values (e.g. " "`0`, `\"\"`, etc)." msgstr "" +"نوعهای استاندارد Rust اغلب `Default` را با مقادیر معقول پیادهسازی میکنند " +"(مثل `0`، `\"\"` و غیره)." #: src/std-traits/default.md:44 msgid "The partial struct initialization works nicely with default." -msgstr "" +msgstr "مقداردهی جزئی ساختارها با `Default` به خوبی کار میکند." #: src/std-traits/default.md:45 msgid "" "The Rust standard library is aware that types can implement `Default` and " "provides convenience methods that use it." msgstr "" +"کتابخانه استاندارد Rust آگاه است که تایپهای مختلف میتوانند `Default` را " +"پیادهسازی کنند و روشهای کمکی را فراهم میکند که از آن استفاده میکنند." #: src/std-traits/default.md:47 msgid "" @@ -7282,6 +7574,9 @@ msgid "" "book/ch05-01-defining-structs.html#creating-instances-from-other-instances-" "with-struct-update-syntax)." msgstr "" +"سینتکس `..` به نام [سینتکس بهروزرسانی ساختار](https://doc.rust-lang.org/book/" +"ch05-01-defining-structs.html#creating-instances-from-other-instances-with-" +"struct-update-syntax) شناخته میشود." #: src/std-traits/closures.md:3 msgid "" @@ -7290,23 +7585,27 @@ msgid "" "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:" msgstr "" +"بستهها یا عبارات لامبدا تایپهایی دارند که نمیتوان نامگذاری کرد. با این حال، " +"آنها پیادهسازیهای ویژه از traits [`Fn`](https://doc.rust-lang.org/std/ops/" +"trait.Fn.html)، [`FnMut`](https://doc.rust-lang.org/std/ops/trait.FnMut." +"html) و [`FnOnce`](https://doc.rust-lang.org/std/ops/trait.FnOnce.html) " +"هستند:" #: src/std-traits/closures.md:10 -#, fuzzy msgid "\"Calling function on {input}\"" -msgstr "فراخوانی متدهای ناامن" +msgstr "\"Calling function on {input}\"" #: src/std-traits/closures.md:16 src/std-traits/closures.md:17 msgid "\"add_3: {}\"" -msgstr "" +msgstr "\"add_3: {}\"" #: src/std-traits/closures.md:24 src/std-traits/closures.md:25 msgid "\"accumulate: {}\"" -msgstr "" +msgstr "\"accumulate: {}\"" #: src/std-traits/closures.md:28 msgid "\"multiply_sum: {}\"" -msgstr "" +msgstr "\"multiply_sum: {}\"" #: src/std-traits/closures.md:35 msgid "" @@ -7314,18 +7613,25 @@ msgid "" "perhaps captures nothing at all. It can be called multiple times " "concurrently." msgstr "" +"یک `Fn` (برای مثال `add_3`) نه مقادیر گرفته شده را مصرف میکند و نه آنها را " +"تغییر میدهد، یا شاید اصلاً چیزی را نمیگیرد. این تایپ میتواند بهطور همزمان " +"چندین بار فراخوانی شود." #: src/std-traits/closures.md:38 msgid "" "An `FnMut` (e.g. `accumulate`) might mutate captured values. You can call it " "multiple times, but not concurrently." msgstr "" +"یک `FnMut` (برای مثال `accumulate`) ممکن است مقادیر گرفته شده را تغییر دهد. " +"شما میتوانید آن را چندین بار فراخوانی کنید، اما نه بهطور همزمان." #: src/std-traits/closures.md:41 msgid "" "If you have an `FnOnce` (e.g. `multiply_sum`), you may only call it once. It " "might consume captured values." msgstr "" +"اگر یک `FnOnce` (برای مثال `multiply_sum`) داشته باشید، تنها میتوانید آن را " +"یکبار فراخوانی کنید. ممکن است مقادیر گرفته شده را مصرف کند." #: src/std-traits/closures.md:44 msgid "" @@ -7333,6 +7639,10 @@ msgid "" "I.e. you can use an `FnMut` wherever an `FnOnce` is called for, and you can " "use an `Fn` wherever an `FnMut` or `FnOnce` is called for." msgstr "" +"`FnMut` یک زیرتایپ از `FnOnce` است. `Fn` نیز یک زیرتایپ از `FnMut` و " +"`FnOnce` است. به عبارت دیگر، میتوانید از `FnMut` در جایی که `FnOnce` نیاز " +"است استفاده کنید و از `Fn` در جایی که `FnMut` یا `FnOnce` نیاز است استفاده " +"کنید." #: src/std-traits/closures.md:48 msgid "" @@ -7340,37 +7650,49 @@ msgid "" "you can (i.e. you call it once), or `FnMut` else, and last `Fn`. This allows " "the most flexibility for the caller." msgstr "" +"زمانی که تابعی تعریف میکنید که یک closure را میگیرد، باید از `FnOnce` " +"استفاده کنید اگر فقط یک بار آن را فراخوانی میکنید (یعنی یک بار استفاده " +"میشود)، یا از `FnMut` در غیر این صورت، و در نهایت از `Fn`. این کار بیشترین " +"انعطافپذیری را برای فراخوانیکننده فراهم میکند." #: src/std-traits/closures.md:52 msgid "" "In contrast, when you have a closure, the most flexible you can have is `Fn` " "(it can be passed everywhere), then `FnMut`, and lastly `FnOnce`." msgstr "" +"در مقابل، زمانی که یک closure دارید، بیشترین انعطافپذیری که میتوانید داشته " +"باشید `Fn` است (که میتواند در هر جایی استفاده شود)، سپس `FnMut` و در نهایت " +"`FnOnce`." #: src/std-traits/closures.md:55 msgid "" "The compiler also infers `Copy` (e.g. for `add_3`) and `Clone` (e.g. " "`multiply_sum`), depending on what the closure captures." msgstr "" +"کامپایلر همچنین `Copy` (برای مثال برای `add_3`) و `Clone` (برای مثال " +"`multiply_sum`) را بر اساس آنچه که closure به دست میآورد، استنتاج میکند." #: src/std-traits/closures.md:58 msgid "" "By default, closures will capture by reference if they can. The `move` " "keyword makes them capture by value." msgstr "" +"بهطور پیشفرض، closure ها اگر بتوانند، با ارجاع (reference) مقادیر را " +"میگیرند. کلمه کلیدی `move` باعث میشود که آنها مقادیر را بهصورت مالکیت (by " +"value) بگیرند." #: src/std-traits/closures.md:63 src/smart-pointers/trait-objects.md:93 #: src/smart-pointers/trait-objects.md:94 msgid "\"{} {}\"" -msgstr "" +msgstr "\"{} {}\"" #: src/std-traits/closures.md:67 msgid "\"Hi\"" -msgstr "" +msgstr "\"Hi\"" #: src/std-traits/closures.md:68 msgid "\"Greg\"" -msgstr "" +msgstr "\"Greg\"" #: src/std-traits/exercise.md:3 msgid "" @@ -7379,29 +7701,35 @@ msgid "" "implement the missing bits. Only rotate ASCII alphabetic characters, to " "ensure the result is still valid UTF-8." msgstr "" +"در این مثال، شما الگوریتم کلاسیک [رمزگذاری \"ROT13\"](https://en.wikipedia." +"org/wiki/ROT13) را پیادهسازی خواهید کرد. این کد را به محیط Playground کپی " +"کرده و بخشهای ناقص آن را پیادهسازی کنید. تنها حروف الفبای ASCII را بچرخانید " +"تا نتیجه همچنان UTF-8 معتبر باقی بماند." #: src/std-traits/exercise.md:15 msgid "// Implement the `Read` trait for `RotDecoder`.\n" -msgstr "" +msgstr "// Implement the `Read` trait for `RotDecoder`.\n" #: src/std-traits/exercise.md:20 src/std-traits/exercise.md:33 #: src/std-traits/solution.md:26 src/std-traits/solution.md:39 msgid "\"Gb trg gb gur bgure fvqr!\"" -msgstr "" +msgstr "\"Gb trg gb gur bgure fvqr!\"" #: src/std-traits/exercise.md:36 src/std-traits/solution.md:42 msgid "\"To get to the other side!\"" -msgstr "" +msgstr "\"To get to the other side!\"" #: src/std-traits/exercise.md:55 msgid "" "What happens if you chain two `RotDecoder` instances together, each rotating " "by 13 characters?" msgstr "" +"چه اتفاقی میافتد اگر دو نمونه از `RotDecoder` را بههم متصل کنید که هر کدام " +"۱۳ کاراکتر را بچرخانند؟" #: src/std-traits/solution.md:16 msgid "'A'" -msgstr "" +msgstr "'A'" #: src/welcome-day-3.md msgid "Welcome to Day 3"