From fea15c75c0e445ff6140001ad820a03df182a5be Mon Sep 17 00:00:00 2001 From: E_Esmaeili Date: Wed, 12 Oct 2022 12:09:40 +0330 Subject: [PATCH 1/7] Translate second part of appendix-02-operators.md --- FARSI/src/appendix-02-operators.md | 299 ++++++++++++++--------------- 1 file changed, 149 insertions(+), 150 deletions(-) diff --git a/FARSI/src/appendix-02-operators.md b/FARSI/src/appendix-02-operators.md index 69722c61..b383fb94 100644 --- a/FARSI/src/appendix-02-operators.md +++ b/FARSI/src/appendix-02-operators.md @@ -6,163 +6,162 @@ ### عملگرها -جدول B-1 شامل عملگرهای Rust است، مثالی از نحوه انجام عملگر +جدول ب-۱ شامل عملگرهای Rust است، مثالی از نحوه انجام عملگر در متن ظاهر می شود، توضیحی کوتاه، و اینکه آیا آن عملگر قابل بازتعریف‌کردن (overloadable) است یا خیر. اگر یک اپراتور قابلیت بازتعریف کردن را داشته باشد، ویژگی مربوطه برای استفاده بازتعریف آن عملگر فهرست شده است. -Table B-1: Operators - -| Operator | Example | Explanation | Overloadable? | -|----------|---------|-------------|---------------| -| `!` | `ident!(...)`, `ident!{...}`, `ident![...]` | Macro expansion | | -| `!` | `!expr` | Bitwise or logical complement | `Not` | -| `!=` | `var != expr` | Nonequality comparison | `PartialEq` | -| `%` | `expr % expr` | Arithmetic remainder | `Rem` | -| `%=` | `var %= expr` | Arithmetic remainder and assignment | `RemAssign` | -| `&` | `&expr`, `&mut expr` | Borrow | | -| `&` | `&type`, `&mut type`, `&'a type`, `&'a mut type` | Borrowed pointer type | | -| `&` | `expr & expr` | Bitwise AND | `BitAnd` | -| `&=` | `var &= expr` | Bitwise AND and assignment | `BitAndAssign` | -| `&&` | `expr && expr` | Logical AND | | -| `*` | `expr * expr` | Arithmetic multiplication | `Mul` | -| `*=` | `var *= expr` | Arithmetic multiplication and assignment | `MulAssign` | -| `*` | `*expr` | Dereference | | -| `*` | `*const type`, `*mut type` | Raw pointer | | -| `+` | `trait + trait`, `'a + trait` | Compound type constraint | | -| `+` | `expr + expr` | Arithmetic addition | `Add` | -| `+=` | `var += expr` | Arithmetic addition and assignment | `AddAssign` | -| `,` | `expr, expr` | Argument and element separator | | -| `-` | `- expr` | Arithmetic negation | `Neg` | -| `-` | `expr - expr` | Arithmetic subtraction | `Sub` | -| `-=` | `var -= expr` | Arithmetic subtraction and assignment | `SubAssign` | -| `->` | `fn(...) -> type`, |...| -> type | Function and closure return type | | -| `.` | `expr.ident` | Member access | | -| `..` | `..`, `expr..`, `..expr`, `expr..expr` | Right-exclusive range literal | | -| `..=` | `..=expr`, `expr..=expr` | Right-inclusive range literal | | -| `..` | `..expr` | Struct literal update syntax | | -| `..` | `variant(x, ..)`, `struct_type { x, .. }` | “And the rest” pattern binding | | -| `...` | `expr...expr` | In a pattern: inclusive range pattern | | -| `/` | `expr / expr` | Arithmetic division | `Div` | -| `/=` | `var /= expr` | Arithmetic division and assignment | `DivAssign` | -| `:` | `pat: type`, `ident: type` | Constraints | | -| `:` | `ident: expr` | Struct field initializer | | -| `:` | `'a: loop {...}` | Loop label | | -| `;` | `expr;` | Statement and item terminator | | -| `;` | `[...; len]` | Part of fixed-size array syntax | | -| `<<` | `expr << expr` | Left-shift | `Shl` | -| `<<=` | `var <<= expr` | Left-shift and assignment | `ShlAssign` | -| `<` | `expr < expr` | Less than comparison | `PartialOrd` | -| `<=` | `expr <= expr` | Less than or equal to comparison | `PartialOrd` | -| `=` | `var = expr`, `ident = type` | Assignment/equivalence | | -| `==` | `expr == expr` | Equality comparison | `PartialEq` | -| `=>` | `pat => expr` | Part of match arm syntax | | -| `>` | `expr > expr` | Greater than comparison | `PartialOrd` | -| `>=` | `expr >= expr` | Greater than or equal to comparison | `PartialOrd` | -| `>>` | `expr >> expr` | Right-shift | `Shr` | -| `>>=` | `var >>= expr` | Right-shift and assignment | `ShrAssign` | -| `@` | `ident @ pat` | Pattern binding | | -| `^` | `expr ^ expr` | Bitwise exclusive OR | `BitXor` | -| `^=` | `var ^= expr` | Bitwise exclusive OR and assignment | `BitXorAssign` | -| | | pat | pat | Pattern alternatives | | -| | | expr | expr | Bitwise OR | `BitOr` | -| |= | var |= expr | Bitwise OR and assignment | `BitOrAssign` | -| || | expr || expr | Logical OR | | -| `?` | `expr?` | Error propagation | | - -### Non-operator Symbols - -The following list contains all non-letters that don’t function as operators; -that is, they don’t behave like a function or method call. - -Table B-2 shows symbols that appear on their own and are valid in a variety of -locations. - -Table B-2: Stand-Alone Syntax - -| Symbol | Explanation | -|--------|-------------| -| `'ident` | Named lifetime or loop label | -| `...u8`, `...i32`, `...f64`, `...usize`, etc. | Numeric literal of specific type | -| `"..."` | String literal | -| `r"..."`, `r#"..."#`, `r##"..."##`, etc. | Raw string literal, escape characters not processed | -| `b"..."` | Byte string literal; constructs a `[u8]` instead of a string | -| `br"..."`, `br#"..."#`, `br##"..."##`, etc. | Raw byte string literal, combination of raw and byte string literal | -| `'...'` | Character literal | -| `b'...'` | ASCII byte literal | -| |...| expr | Closure | -| `!` | Always empty bottom type for diverging functions | -| `_` | “Ignored” pattern binding; also used to make integer literals readable | - -Table B-3 shows symbols that appear in the context of a path through the module -hierarchy to an item. - -Table B-3: Path-Related Syntax - -| Symbol | Explanation | -|--------|-------------| -| `ident::ident` | Namespace path | -| `::path` | Path relative to the crate root (i.e., an explicitly absolute path) | -| `self::path` | Path relative to the current module (i.e., an explicitly relative path). -| `super::path` | Path relative to the parent of the current module | -| `type::ident`, `::ident` | Associated constants, functions, and types | -| `::...` | Associated item for a type that cannot be directly named (e.g., `<&T>::...`, `<[T]>::...`, etc.) | -| `trait::method(...)` | Disambiguating a method call by naming the trait that defines it | -| `type::method(...)` | Disambiguating a method call by naming the type for which it’s defined | -| `::method(...)` | Disambiguating a method call by naming the trait and type | +جدول ب-۱: عملگرها + +| قابلیت بازتعریف؟ | توضیح | نمونه | عملگر | +|------------------|--------------------------------------------:|---------------------------------------------------------|---------------------------| +| | بسط و تعریف ماکرو | `ident!(...)`, `ident!{...}`, `ident![...]` | `!` | +| `Not` | نقیض بیتی یا منطقی | `!expr` | `!` | +| `PartialEq` | مقایسه عدم برابری | `var != expr` | `!=` | +| `Rem` | باقیمانده حسابی | `expr % expr` | `%` | +| `RemAssign` | باقیمانده حسابی و انتساب | `var %= expr` | `%=` | +| | تقریض | `&expr`, `&mut expr` | `&` | +| | تقریض نوع اشاره گر | `&type`, `&mut type`, `&'a type`, `&'a mut type` | `&` | +| `BitAnd` | عطب بیتی | `expr & expr` | `&` | +| `BitAndAssign` | عطف بیتی و انتساب | `var &= expr` | `&=` | +| | عطف حسابی | `expr && expr` | `&&` | +| `Mul` | ضرب حسابی | `expr * expr` | `*` | +| `MulAssign` | ضرت و انتساب ریاضی | `var *= expr` | `*=` | +| | لغو ارجاع | `*expr` | `*` | +| | اشاره گر خام | `*const type`, `*mut type` | `*` | +| | محدودیت نوع داده مرکب | `trait + trait`, `'a + trait` | `+` | +| `Add` | جمع حسابی | `expr + expr` | `+` | +| `AddAssign` | جمع حسابی و انتساب | `var += expr` | `+=` | +| | جداکننده ی ورودی توابع و عنصرها | `expr, expr` | `,` | +| `Neg` | نقیض حسابی | `- expr` | `-` | +| `Sub` | تفریق حسابی | `expr - expr` | `-` | +| `SubAssign` | تفریق حسابی و انتساب | `var -= expr` | `-=` | +| | نوع داده ی خروجی تابع و شرط | `fn(...) -> type`, |...| -> type | `->` | +| | دسترسی به عضو | `expr.ident` | `.` | +| | مجوز غیرانحصاری محدوده ی بیان شده | `..`, `expr..`, `..expr`, `expr..expr` | `..` | +| | مجوز غیرانحصاری محدوده ی بیان شده | `..=expr`, `expr..=expr` | `..=` | +| | نحو به روزرسانی محدوده ی بیان شده | `..expr` | `..` | +| | اتصال الگوی «و ادامه» | `variant(x, ..)`, `struct_type { x, .. }` | `..` | +| | در یک الگو: الگوی غیرانحصاری در محدوده | `expr...expr` | `...` | +| `Div` | تقسیم حسابی | `expr / expr` | `/` | +| `DivAssign` | تقسیم حسابی و انتساب | `var /= expr` | `/=` | +| | مشخص کننده ی محدودیت | `pat: type`, `ident: type` | `:` | +| | مقداردهنده ی اولیه مشخصه در نوع داده ساختار | `ident: expr` | `:` | +| | برچسب حلقه | `'a: loop {...}` | `:` | +| | پایان دهنده عبارات و موارد دیگر | `expr;` | `;` | +| | بخشی از نحو آرایه با اندازه ی ثابت | `[...; len]` | `;` | +| `Shl` | انتقال به چپ | `expr << expr` | `<<` | +| `ShlAssign` | انتقال به چپ و انتساب | `var <<= expr` | `<<=` | +| `PartialOrd` | مقایسه کوچکتر | `expr < expr` | `<` | +| `PartialOrd` | مقایسه ی کوچکتر یا برابری | `expr <= expr` | `<=` | +| | انتساب/معادل | `var = expr`, `ident = type` | `=` | +| `PartialEq` | مقایسه ی برابری | `expr == expr` | `==` | +| | بخشی از نحو انطباق الگو | `pat => expr` | `=>` | +| `PartialOrd` | مقایسه بزرگتر | `expr > expr` | `>` | +| `PartialOrd` | مقایسه ی بزرگتر یا برابر | `expr >= expr` | `>=` | +| `Shr` | انتقال به راست | `expr >> expr` | `>>` | +| `ShrAssign` | انتقال به راست و انتساب | `var >>= expr` | `>>=` | +| | اتصال الگو | `ident @ pat` | `@` | +| `BitXor` | یای انحصاری | `expr ^ expr` | `^` | +| `BitXorAssign` | یای انحصاری و انتساب | `var ^= expr` | `^=` | +| | جایگزین الگو | pat | pat | | | +| `BitOr` | یای بیتی | expr | expr | | | +| `BitOrAssign` | یای بیتی و انتساب | var |= expr | |= | +| | یای منطقی | expr || expr | || | +| | انتشار خطا | `expr?` | `?` | + +### نمادهای غیر عملگر + +فهرست زیر شامل تمام غیرحروفی است که به عنوان عملگر عمل نمی‌کنند. +یعنی آنها مانند فراخوانی روند یا تابع رفتار نمی کنند. + +جدول ب-۲ نمادهایی را نشان می‌دهد که به تنهایی ظاهر می‌شوند و در انواع مختلف مکان‌ها معتبر هستند. + + +جدول ب-۲: نحو مستقل + +| توضیح | نماد | +|------------------------------------------------------------------------------:|-----------------------------------------------| +| مدت عمر نام گذاری شده یا زمان حلقه | `'ident` | +| اندازه ی عددی یک نوع خاص | `...u8`, `...i32`, `...f64`, `...usize`, etc. | +| نمایش رشته | `"..."` | +| نمایش رشته ی خام، نویسه های خاص پردازش نشده اند | `r"..."`, `r#"..."#`, `r##"..."##`, etc. | +| نمایش رشته بیتی، به جای یک رشته، یک `[u8]` می سازد | `b"..."` | +| نمایش رشته خام و بایتی، ترکیبی از رشته ی خام و بیتی | `br"..."`, `br#"..."#`, `br##"..."##`, etc. | +| نمایش نویسه | `'...'` | +| نمایش بیتی ASCII | `b'...'` | +| پایان عبارت | |...| expr | +| همیشه نوع پایین را برای توابع واگرا خالی می کنید | `!` | +| اتصال الگوی "نادیده گرفته شده". همچنین برای خوانایی اعداد صحیح استفاده می شود | `_` | + +جدول ب-۳ نمادهایی را نشان می دهد که در زمینه‌ی یک مسیر از طریق سلسله مراتب ماژول به یک آیتم ظاهر می شوند. + +جدول ب-۳: نحو مرتبط با مسیر + +| شرح | نماد | +|--------------------------------------------------------------------------------------------------|-----------------------------------------| +| مسیر فضای نام (namespace) | `ident::ident` | +| مسیر نسبت به کتابخانه ی ریشه (یعنی یک مسیر مطلق) | `::path` | +| Path relative to the current module (i.e., an explicitly relative path). | `self::path` | +| Path relative to the parent of the current module | `super::path` | +| Associated constants, functions, and types | `type::ident`, `::ident` | +| Associated item for a type that cannot be directly named (e.g., `<&T>::...`, `<[T]>::...`, etc.) | `::...` | +| Disambiguating a method call by naming the trait that defines it | `trait::method(...)` | +| Disambiguating a method call by naming the type for which it’s defined | `type::method(...)` | +| Disambiguating a method call by naming the trait and type | `::method(...)` | Table B-4 shows symbols that appear in the context of using generic type parameters. Table B-4: Generics -| Symbol | Explanation | -|--------|-------------| -| `path<...>` | Specifies parameters to generic type in a type (e.g., `Vec`) | +| Symbol | Explanation | +|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------| +| `path<...>` | Specifies parameters to generic type in a type (e.g., `Vec`) | | `path::<...>`, `method::<...>` | Specifies parameters to generic type, function, or method in an expression; often referred to as turbofish (e.g., `"42".parse::()`) | -| `fn ident<...> ...` | Define generic function | -| `struct ident<...> ...` | Define generic structure | -| `enum ident<...> ...` | Define generic enumeration | -| `impl<...> ...` | Define generic implementation | -| `for<...> type` | Higher-ranked lifetime bounds | -| `type` | A generic type where one or more associated types have specific assignments (e.g., `Iterator`) | +| `fn ident<...> ...` | Define generic function | +| `struct ident<...> ...` | Define generic structure | +| `enum ident<...> ...` | Define generic enumeration | +| `impl<...> ...` | Define generic implementation | +| `for<...> type` | Higher-ranked lifetime bounds | +| `type` | A generic type where one or more associated types have specific assignments (e.g., `Iterator`) | Table B-5 shows symbols that appear in the context of constraining generic type parameters with trait bounds. Table B-5: Trait Bound Constraints -| Symbol | Explanation | -|--------|-------------| -| `T: U` | Generic parameter `T` constrained to types that implement `U` | -| `T: 'a` | Generic type `T` must outlive lifetime `'a` (meaning the type cannot transitively contain any references with lifetimes shorter than `'a`) | -| `T : 'static` | Generic type `T` contains no borrowed references other than `'static` ones | -| `'b: 'a` | Generic lifetime `'b` must outlive lifetime `'a` | -| `T: ?Sized` | Allow generic type parameter to be a dynamically sized type | -| `'a + trait`, `trait + trait` | Compound type constraint | +| Symbol | Explanation | +|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| +| `T: U` | Generic parameter `T` constrained to types that implement `U` | +| `T: 'a` | Generic type `T` must outlive lifetime `'a` (meaning the type cannot transitively contain any references with lifetimes shorter than `'a`) | +| `T : 'static` | Generic type `T` contains no borrowed references other than `'static` ones | +| `'b: 'a` | Generic lifetime `'b` must outlive lifetime `'a` | +| `T: ?Sized` | Allow generic type parameter to be a dynamically sized type | +| `'a + trait`, `trait + trait` | Compound type constraint | Table B-6 shows symbols that appear in the context of calling or defining macros and specifying attributes on an item. Table B-6: Macros and Attributes -| Symbol | Explanation | -|--------|-------------| -| `#[meta]` | Outer attribute | -| `#![meta]` | Inner attribute | -| `$ident` | Macro substitution | -| `$ident:kind` | Macro capture | -| `$(…)…` | Macro repetition | -| `ident!(...)`, `ident!{...}`, `ident![...]` | Macro invocation | +| Symbol | Explanation | +|---------------------------------------------|--------------------| +| `#[meta]` | Outer attribute | +| `#![meta]` | Inner attribute | +| `$ident` | Macro substitution | +| `$ident:kind` | Macro capture | +| `$(…)…` | Macro repetition | +| `ident!(...)`, `ident!{...}`, `ident![...]` | Macro invocation | Table B-7 shows symbols that create comments. Table B-7: Comments -| Symbol | Explanation | -|--------|-------------| -| `//` | Line comment | -| `//!` | Inner line doc comment | -| `///` | Outer line doc comment | -| `/*...*/` | Block comment | +| Symbol | Explanation | +|------------|-------------------------| +| `//` | Line comment | +| `//!` | Inner line doc comment | +| `///` | Outer line doc comment | +| `/*...*/` | Block comment | | `/*!...*/` | Inner block doc comment | | `/**...*/` | Outer block doc comment | @@ -170,34 +169,34 @@ Table B-8 shows symbols that appear in the context of using tuples. Table B-8: Tuples -| Symbol | Explanation | -|--------|-------------| -| `()` | Empty tuple (aka unit), both literal and type | -| `(expr)` | Parenthesized expression | -| `(expr,)` | Single-element tuple expression | -| `(type,)` | Single-element tuple type | -| `(expr, ...)` | Tuple expression | -| `(type, ...)` | Tuple type | -| `expr(expr, ...)` | Function call expression; also used to initialize tuple `struct`s and tuple `enum` variants | -| `expr.0`, `expr.1`, etc. | Tuple indexing | +| Symbol | Explanation | +|--------------------------|---------------------------------------------------------------------------------------------| +| `()` | Empty tuple (aka unit), both literal and type | +| `(expr)` | Parenthesized expression | +| `(expr,)` | Single-element tuple expression | +| `(type,)` | Single-element tuple type | +| `(expr, ...)` | Tuple expression | +| `(type, ...)` | Tuple type | +| `expr(expr, ...)` | Function call expression; also used to initialize tuple `struct`s and tuple `enum` variants | +| `expr.0`, `expr.1`, etc. | Tuple indexing | Table B-9 shows the contexts in which curly braces are used. Table B-9: Curly Brackets -| Context | Explanation | -|---------|-------------| -| `{...}` | Block expression | +| Context | Explanation | +|--------------|------------------| +| `{...}` | Block expression | | `Type {...}` | `struct` literal | Table B-10 shows the contexts in which square brackets are used. Table B-10: Square Brackets -| Context | Explanation | -|---------|-------------| -| `[...]` | Array literal | -| `[expr; len]` | Array literal containing `len` copies of `expr` | -| `[type; len]` | Array type containing `len` instances of `type` | -| `expr[expr]` | Collection indexing. Overloadable (`Index`, `IndexMut`) | +| Context | Explanation | +|----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------| +| `[...]` | Array literal | +| `[expr; len]` | Array literal containing `len` copies of `expr` | +| `[type; len]` | Array type containing `len` instances of `type` | +| `expr[expr]` | Collection indexing. Overloadable (`Index`, `IndexMut`) | | `expr[..]`, `expr[a..]`, `expr[..b]`, `expr[a..b]` | Collection indexing pretending to be collection slicing, using `Range`, `RangeFrom`, `RangeTo`, or `RangeFull` as the “index” | From 8b34f3ac55f6b3275f9cefcaf2205f0e3cc7d4d8 Mon Sep 17 00:00:00 2001 From: E_Esmaeili Date: Sun, 6 Nov 2022 11:28:16 +0330 Subject: [PATCH 2/7] Translate third part of appendix-02-operators.md --- FARSI/src/appendix-02-operators.md | 31 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/FARSI/src/appendix-02-operators.md b/FARSI/src/appendix-02-operators.md index b383fb94..db90d78b 100644 --- a/FARSI/src/appendix-02-operators.md +++ b/FARSI/src/appendix-02-operators.md @@ -96,22 +96,21 @@ جدول ب-۳: نحو مرتبط با مسیر -| شرح | نماد | -|--------------------------------------------------------------------------------------------------|-----------------------------------------| -| مسیر فضای نام (namespace) | `ident::ident` | -| مسیر نسبت به کتابخانه ی ریشه (یعنی یک مسیر مطلق) | `::path` | -| Path relative to the current module (i.e., an explicitly relative path). | `self::path` | -| Path relative to the parent of the current module | `super::path` | -| Associated constants, functions, and types | `type::ident`, `::ident` | -| Associated item for a type that cannot be directly named (e.g., `<&T>::...`, `<[T]>::...`, etc.) | `::...` | -| Disambiguating a method call by naming the trait that defines it | `trait::method(...)` | -| Disambiguating a method call by naming the type for which it’s defined | `type::method(...)` | -| Disambiguating a method call by naming the trait and type | `::method(...)` | - -Table B-4 shows symbols that appear in the context of using generic type -parameters. - -Table B-4: Generics +| شرح | نماد | +|------------------------------------------------------------------------------------------------------------|-----------------------------------------| +| مسیر فضای نام (namespace) | `ident::ident` | +| مسیر نسبت به کتابخانه ی ریشه (یعنی یک مسیر مطلق) | `::path` | +| مسیر نسبت به مؤلفه ی جاری (یعنی به طور صریح مسیر نسبی) | `self::path` | +| مسیر نسبت به والد مؤلفه ی جاری | `super::path` | +| ثابت ها، تابع ها و نوع داده های وابسته | `type::ident`, `::ident` | +| مورد وابسته برای یک نوع داده که به طور مستقیم قابل نام گذاری نیست (نمونه `<&T>::...`, `<[T]>::...` و غیره) | `::...` | +| ابهام زدایی از فراخوانی تابع با نام ‌گذاری صفتی که آن را تعریف می کند | `trait::method(...)` | +| ابهام زدایی از فراخوانی تابع با نام ‌گذاری نوعی که برای آن تعریف شده است | `type::method(...)` | +| رفع ابهام از فراخوانی تابع با نام گذاری صفت و نوع | `::method(...)` | + +جدول ب-۴ نمادهایی را نشان می دهد که در زمینه ی استفاده از پارامترهای نوع عمومی ظاهر می شوند. + +جدول ب-۴: نوع عمومی | Symbol | Explanation | |--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------| From 0fd095f4480bb9f53b7736bfeb9b7e7302bd5db7 Mon Sep 17 00:00:00 2001 From: E_Esmaeili Date: Wed, 9 Nov 2022 09:51:12 +0330 Subject: [PATCH 3/7] Translate 4th part of appendix-02-operators.md --- FARSI/src/appendix-02-operators.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/FARSI/src/appendix-02-operators.md b/FARSI/src/appendix-02-operators.md index db90d78b..0f72a050 100644 --- a/FARSI/src/appendix-02-operators.md +++ b/FARSI/src/appendix-02-operators.md @@ -112,21 +112,21 @@ جدول ب-۴: نوع عمومی -| Symbol | Explanation | -|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------| -| `path<...>` | Specifies parameters to generic type in a type (e.g., `Vec`) | -| `path::<...>`, `method::<...>` | Specifies parameters to generic type, function, or method in an expression; often referred to as turbofish (e.g., `"42".parse::()`) | -| `fn ident<...> ...` | Define generic function | -| `struct ident<...> ...` | Define generic structure | -| `enum ident<...> ...` | Define generic enumeration | -| `impl<...> ...` | Define generic implementation | -| `for<...> type` | Higher-ranked lifetime bounds | -| `type` | A generic type where one or more associated types have specific assignments (e.g., `Iterator`) | - -Table B-5 shows symbols that appear in the context of constraining generic type -parameters with trait bounds. - -Table B-5: Trait Bound Constraints +| شرح | نماد | +|--------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------| +| پارامترهای نوع عمومی را در یک نوع داده مشخص می کند (نمونه `Vec`) | `path<...>` | +| پارامترهای نوع عمومی، تابع یا تابع عضو کلاس را در یک عبارت مشخص می کند. اغلب به عنوان توربوفیش شناخته می شود (نمونه `"42".parse::()`) | `path::<...>`, `method::<...>` | +| تعریف یک تابع نوع عمومی | `fn ident<...> ...` | +| تعریف یک نوع داده‌ ساختار (struct) عمومی | `struct ident<...> ...` | +| تعریف یک نوع داده ی شمارشی عمومی | `enum ident<...> ...` | +| تعریف نوع عمومی پیاده سازی | `impl<...> ...` | +| محدوده ی طول عمر با رتبه ی بالاتر | `for<...> type` | +| یک نوع عمومی که در آن یک یا چند نوع مرتبط دارای تخصیص خاص هستند (نمونه `Iterator`) | `type` | + +جدول ب-۵ نمادهایی را نشان می دهد که در زمینه ی محدود کردن پارامترهای نوع عمومی با +مرزهای نوع صفت ظاهر می شوند. + +جدول ب-۵: مرزهای محدودیت صفت | Symbol | Explanation | |-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| From 761753a4c1fd8ac58beb2a79c0c43a2c1f62cb47 Mon Sep 17 00:00:00 2001 From: E_Esmaeili Date: Sun, 13 Nov 2022 14:06:29 +0330 Subject: [PATCH 4/7] Translate 5th part of appendix-02-operators.md --- FARSI/src/appendix-02-operators.md | 62 +++++++++++++++--------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/FARSI/src/appendix-02-operators.md b/FARSI/src/appendix-02-operators.md index 0f72a050..a60eae00 100644 --- a/FARSI/src/appendix-02-operators.md +++ b/FARSI/src/appendix-02-operators.md @@ -96,51 +96,51 @@ جدول ب-۳: نحو مرتبط با مسیر -| شرح | نماد | -|------------------------------------------------------------------------------------------------------------|-----------------------------------------| -| مسیر فضای نام (namespace) | `ident::ident` | -| مسیر نسبت به کتابخانه ی ریشه (یعنی یک مسیر مطلق) | `::path` | -| مسیر نسبت به مؤلفه ی جاری (یعنی به طور صریح مسیر نسبی) | `self::path` | -| مسیر نسبت به والد مؤلفه ی جاری | `super::path` | -| ثابت ها، تابع ها و نوع داده های وابسته | `type::ident`, `::ident` | +| شرح | نماد | +|-----------------------------------------------------------------------------------------------------------:|-----------------------------------------| +| مسیر فضای نام (namespace) | `ident::ident` | +| مسیر نسبت به کتابخانه ی ریشه (یعنی یک مسیر مطلق) | `::path` | +| مسیر نسبت به مؤلفه ی جاری (یعنی به طور صریح مسیر نسبی) | `self::path` | +| مسیر نسبت به والد مؤلفه ی جاری | `super::path` | +| ثابت ها، تابع ها و نوع داده های وابسته | `type::ident`, `::ident` | | مورد وابسته برای یک نوع داده که به طور مستقیم قابل نام گذاری نیست (نمونه `<&T>::...`, `<[T]>::...` و غیره) | `::...` | -| ابهام زدایی از فراخوانی تابع با نام ‌گذاری صفتی که آن را تعریف می کند | `trait::method(...)` | -| ابهام زدایی از فراخوانی تابع با نام ‌گذاری نوعی که برای آن تعریف شده است | `type::method(...)` | -| رفع ابهام از فراخوانی تابع با نام گذاری صفت و نوع | `::method(...)` | +| ابهام زدایی از فراخوانی تابع با نام گذاری صفتی که آن را تعریف می کند | `trait::method(...)` | +| ابهام زدایی از فراخوانی تابع با نام گذاری نوعی که برای آن تعریف شده است | `type::method(...)` | +| رفع ابهام از فراخوانی تابع با نام گذاری صفت و نوع | `::method(...)` | جدول ب-۴ نمادهایی را نشان می دهد که در زمینه ی استفاده از پارامترهای نوع عمومی ظاهر می شوند. جدول ب-۴: نوع عمومی -| شرح | نماد | -|--------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------| -| پارامترهای نوع عمومی را در یک نوع داده مشخص می کند (نمونه `Vec`) | `path<...>` | -| پارامترهای نوع عمومی، تابع یا تابع عضو کلاس را در یک عبارت مشخص می کند. اغلب به عنوان توربوفیش شناخته می شود (نمونه `"42".parse::()`) | `path::<...>`, `method::<...>` | -| تعریف یک تابع نوع عمومی | `fn ident<...> ...` | -| تعریف یک نوع داده‌ ساختار (struct) عمومی | `struct ident<...> ...` | -| تعریف یک نوع داده ی شمارشی عمومی | `enum ident<...> ...` | -| تعریف نوع عمومی پیاده سازی | `impl<...> ...` | -| محدوده ی طول عمر با رتبه ی بالاتر | `for<...> type` | -| یک نوع عمومی که در آن یک یا چند نوع مرتبط دارای تخصیص خاص هستند (نمونه `Iterator`) | `type` | +| شرح | نماد | +|----------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------| +| پارامترهای نوع عمومی را در یک نوع داده مشخص می کند (نمونه `Vec`) | `path<...>` | +| پارامتر های نوع عمومی، تابع یا تابع عضو کلاس را در یک عبارت مشخص می کند. اغلب به عنوان توربوفیش شناخته می شود (نمونه `"42".parse::()`) | `path::<...>`, `method::<...>` | +| تعریف یک تابع نوع عمومی | `fn ident<...> ...` | +| تعریف یک نوع داده‌ ساختار (struct) عمومی | `struct ident<...> ...` | +| تعریف یک نوع داده ی شمارشی عمومی | `enum ident<...> ...` | +| تعریف نوع عمومی پیاده سازی | `impl<...> ...` | +| محدوده ی طول عمر با رتبه ی بالاتر | `for<...> type` | +| یک نوع عمومی که در آن یک یا چند نوع مرتبط دارای تخصیص خاص هستند (نمونه `Iterator`) | `type` | جدول ب-۵ نمادهایی را نشان می دهد که در زمینه ی محدود کردن پارامترهای نوع عمومی با مرزهای نوع صفت ظاهر می شوند. جدول ب-۵: مرزهای محدودیت صفت -| Symbol | Explanation | -|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| -| `T: U` | Generic parameter `T` constrained to types that implement `U` | -| `T: 'a` | Generic type `T` must outlive lifetime `'a` (meaning the type cannot transitively contain any references with lifetimes shorter than `'a`) | -| `T : 'static` | Generic type `T` contains no borrowed references other than `'static` ones | -| `'b: 'a` | Generic lifetime `'b` must outlive lifetime `'a` | -| `T: ?Sized` | Allow generic type parameter to be a dynamically sized type | -| `'a + trait`, `trait + trait` | Compound type constraint | +| شرح | نماد | +|:------------------------------------------------------------------------------------------------------------------------------------:|-------------------------------| +| پارامتر نوع عمومی 'T' محدود به انواعی است که 'U' را پیاده سازی می کنند | `T: U` | +| نوع عمومی 'T' باید بیشتر از عمر 'a' عمر کند (به این معنی که این نوع نمی تواند به طور موقت حاوی هیچ مرجعی با طول عمر کمتر از'a' باشد) | `T: 'a` | +| نوع عمومی `T` حاوی هیچ مرجع قرضی غیر از «ایستا» نیست | `T : 'static` | +| عمر عمومی «b» باید بیشتر از عمر «a» باشد | `'b: 'a` | +| اجازه دهید پارامتر نوع عمومی یک نوع اندازه ی پویا باشد | `T: ?Sized` | +| محدودیت نوع مرکب | `'a + trait`, `trait + trait` | -Table B-6 shows symbols that appear in the context of calling or defining -macros and specifying attributes on an item. +جدول ب-۶ نمادهایی را نشان می دهد که در زمینه فراخوانی یا تعریف ماکروها و مشخص کردن +ویژگی ها روی یک آیتم ظاهر می شوند. -Table B-6: Macros and Attributes +جدول ب-۶: ماکروها و ویژگی‌ها | Symbol | Explanation | |---------------------------------------------|--------------------| From 0b976f18484bf25bee50e5f6396818d88319a64b Mon Sep 17 00:00:00 2001 From: E_Esmaeili Date: Sun, 27 Nov 2022 07:58:25 +0330 Subject: [PATCH 5/7] Translate 6th part of appendix-02-operators.md --- FARSI/src/appendix-02-operators.md | 42 +++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/FARSI/src/appendix-02-operators.md b/FARSI/src/appendix-02-operators.md index a60eae00..8cb20beb 100644 --- a/FARSI/src/appendix-02-operators.md +++ b/FARSI/src/appendix-02-operators.md @@ -142,27 +142,27 @@ جدول ب-۶: ماکروها و ویژگی‌ها -| Symbol | Explanation | -|---------------------------------------------|--------------------| -| `#[meta]` | Outer attribute | -| `#![meta]` | Inner attribute | -| `$ident` | Macro substitution | -| `$ident:kind` | Macro capture | -| `$(…)…` | Macro repetition | -| `ident!(...)`, `ident!{...}`, `ident![...]` | Macro invocation | - -Table B-7 shows symbols that create comments. - -Table B-7: Comments - -| Symbol | Explanation | -|------------|-------------------------| -| `//` | Line comment | -| `//!` | Inner line doc comment | -| `///` | Outer line doc comment | -| `/*...*/` | Block comment | -| `/*!...*/` | Inner block doc comment | -| `/**...*/` | Outer block doc comment | +| شرح | نماد | +|----------------|---------------------------------------------| +| صفت بیرونی | `#[meta]` | +| صفت درونی | `#![meta]` | +| جایگزینی ماکرو | `$ident` | +| ضبط ماکرو | `$ident:kind` | +| تکرار ماکرو | `$(…)…` | +| فراخوانی ماکرو | `ident!(...)`, `ident!{...}`, `ident![...]` | + +جدول ب-۷ نمادهایی را نشان می‌دهد که دیدگاه (comment) ایجاد می‌کنند. + +جدول ب-۷: دیدگاه‌ها + +| شرح | نماد | +|---------------------------|------------| +| دیدگاه تک خطی | `//` | +| دیدگاه سندی درونی | `//!` | +| دیدگاه سندی بیرونی | `///` | +| دیدگاه چندخطی | `/*...*/` | +| دیدگاه سندی چندخطی درونی | `/*!...*/` | +| دیدگاه سندی چندخطی بیرونی | `/**...*/` | Table B-8 shows symbols that appear in the context of using tuples. From 4ed6437a7f97b8345665506141b03575b661e7a9 Mon Sep 17 00:00:00 2001 From: E_Esmaeili Date: Tue, 29 Nov 2022 11:17:28 +0330 Subject: [PATCH 6/7] Translate 7th part of appendix-02-operators.md --- FARSI/src/appendix-02-operators.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/FARSI/src/appendix-02-operators.md b/FARSI/src/appendix-02-operators.md index 8cb20beb..ddcd1fe1 100644 --- a/FARSI/src/appendix-02-operators.md +++ b/FARSI/src/appendix-02-operators.md @@ -164,20 +164,20 @@ | دیدگاه سندی چندخطی درونی | `/*!...*/` | | دیدگاه سندی چندخطی بیرونی | `/**...*/` | -Table B-8 shows symbols that appear in the context of using tuples. - -Table B-8: Tuples - -| Symbol | Explanation | -|--------------------------|---------------------------------------------------------------------------------------------| -| `()` | Empty tuple (aka unit), both literal and type | -| `(expr)` | Parenthesized expression | -| `(expr,)` | Single-element tuple expression | -| `(type,)` | Single-element tuple type | -| `(expr, ...)` | Tuple expression | -| `(type, ...)` | Tuple type | -| `expr(expr, ...)` | Function call expression; also used to initialize tuple `struct`s and tuple `enum` variants | -| `expr.0`, `expr.1`, etc. | Tuple indexing | +جدول ب-۸ نمادهایی را نشان می‌دهد که زمینه‌ی استفاده از چندتایی (tuple) ها ظاهر می‌شوند. + +جدول ب-۸: چندتایی‌ها + +| شرح | نماد | +|--------------------------------------------------------------------------------------|--------------------------| +| چندتایی خالی (یا واحد)، هم نحو و هم نوع | `()` | +| عبارت داخل کمانه | `(expr)` | +| عبارت چندتایی تک‌ عنصری | `(expr,)` | +| نوع داده ی چندتایی تک عنصری | `(type,)` | +| عبارت چندتایی | `(expr, ...)` | +| نوع داده ی چندتایی | `(type, ...)` | +| بیان فراخوانی تابع. همچنین برای مقداردهی اولیه `struct` و تاپل `enum` استفاده می شود | `expr(expr, ...)` | +| نمایه‌سازی چندتایی | `expr.0`, `expr.1`, etc. | Table B-9 shows the contexts in which curly braces are used. From cba6bbd7a436f69e5bf8daea7afd174cc07aa9ba Mon Sep 17 00:00:00 2001 From: E_Esmaeili Date: Tue, 6 Dec 2022 13:20:28 +0330 Subject: [PATCH 7/7] Translate last part of appendix-02-operators.md --- FARSI/src/appendix-02-operators.md | 104 ++++++++++++++--------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/FARSI/src/appendix-02-operators.md b/FARSI/src/appendix-02-operators.md index ddcd1fe1..9a502ba5 100644 --- a/FARSI/src/appendix-02-operators.md +++ b/FARSI/src/appendix-02-operators.md @@ -112,55 +112,55 @@ جدول ب-۴: نوع عمومی -| شرح | نماد | -|----------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------| -| پارامترهای نوع عمومی را در یک نوع داده مشخص می کند (نمونه `Vec`) | `path<...>` | +| شرح | نماد | +|---------------------------------------------------------------------------------------------------------------------------------------------:|--------------------------------| +| پارامترهای نوع عمومی را در یک نوع داده مشخص می کند (نمونه `Vec`) | `path<...>` | | پارامتر های نوع عمومی، تابع یا تابع عضو کلاس را در یک عبارت مشخص می کند. اغلب به عنوان توربوفیش شناخته می شود (نمونه `"42".parse::()`) | `path::<...>`, `method::<...>` | -| تعریف یک تابع نوع عمومی | `fn ident<...> ...` | -| تعریف یک نوع داده‌ ساختار (struct) عمومی | `struct ident<...> ...` | -| تعریف یک نوع داده ی شمارشی عمومی | `enum ident<...> ...` | -| تعریف نوع عمومی پیاده سازی | `impl<...> ...` | -| محدوده ی طول عمر با رتبه ی بالاتر | `for<...> type` | -| یک نوع عمومی که در آن یک یا چند نوع مرتبط دارای تخصیص خاص هستند (نمونه `Iterator`) | `type` | +| تعریف یک تابع نوع عمومی | `fn ident<...> ...` | +| تعریف یک نوع داده‌ ساختار (struct) عمومی | `struct ident<...> ...` | +| تعریف یک نوع داده ی شمارشی عمومی | `enum ident<...> ...` | +| تعریف نوع عمومی پیاده سازی | `impl<...> ...` | +| محدوده ی طول عمر با رتبه ی بالاتر | `for<...> type` | +| یک نوع عمومی که در آن یک یا چند نوع مرتبط دارای تخصیص خاص هستند (نمونه `Iterator`) | `type` | جدول ب-۵ نمادهایی را نشان می دهد که در زمینه ی محدود کردن پارامترهای نوع عمومی با مرزهای نوع صفت ظاهر می شوند. جدول ب-۵: مرزهای محدودیت صفت -| شرح | نماد | -|:------------------------------------------------------------------------------------------------------------------------------------:|-------------------------------| -| پارامتر نوع عمومی 'T' محدود به انواعی است که 'U' را پیاده سازی می کنند | `T: U` | +| شرح | نماد | +|-------------------------------------------------------------------------------------------------------------------------------------:|-------------------------------| +| پارامتر نوع عمومی 'T' محدود به انواعی است که 'U' را پیاده سازی می کنند | `T: U` | | نوع عمومی 'T' باید بیشتر از عمر 'a' عمر کند (به این معنی که این نوع نمی تواند به طور موقت حاوی هیچ مرجعی با طول عمر کمتر از'a' باشد) | `T: 'a` | -| نوع عمومی `T` حاوی هیچ مرجع قرضی غیر از «ایستا» نیست | `T : 'static` | -| عمر عمومی «b» باید بیشتر از عمر «a» باشد | `'b: 'a` | -| اجازه دهید پارامتر نوع عمومی یک نوع اندازه ی پویا باشد | `T: ?Sized` | -| محدودیت نوع مرکب | `'a + trait`, `trait + trait` | +| نوع عمومی `T` حاوی هیچ مرجع قرضی غیر از «ایستا» نیست | `T : 'static` | +| عمر عمومی «b» باید بیشتر از عمر «a» باشد | `'b: 'a` | +| اجازه دهید پارامتر نوع عمومی یک نوع اندازه ی پویا باشد | `T: ?Sized` | +| محدودیت نوع مرکب | `'a + trait`, `trait + trait` | جدول ب-۶ نمادهایی را نشان می دهد که در زمینه فراخوانی یا تعریف ماکروها و مشخص کردن ویژگی ها روی یک آیتم ظاهر می شوند. جدول ب-۶: ماکروها و ویژگی‌ها -| شرح | نماد | -|----------------|---------------------------------------------| -| صفت بیرونی | `#[meta]` | -| صفت درونی | `#![meta]` | +| شرح | نماد | +|---------------:|---------------------------------------------| +| صفت بیرونی | `#[meta]` | +| صفت درونی | `#![meta]` | | جایگزینی ماکرو | `$ident` | -| ضبط ماکرو | `$ident:kind` | -| تکرار ماکرو | `$(…)…` | +| ضبط ماکرو | `$ident:kind` | +| تکرار ماکرو | `$(…)…` | | فراخوانی ماکرو | `ident!(...)`, `ident!{...}`, `ident![...]` | جدول ب-۷ نمادهایی را نشان می‌دهد که دیدگاه (comment) ایجاد می‌کنند. جدول ب-۷: دیدگاه‌ها -| شرح | نماد | -|---------------------------|------------| -| دیدگاه تک خطی | `//` | -| دیدگاه سندی درونی | `//!` | -| دیدگاه سندی بیرونی | `///` | -| دیدگاه چندخطی | `/*...*/` | +| شرح | نماد | +|:-------------------------:|------------| +| دیدگاه تک خطی | `//` | +| دیدگاه سندی درونی | `//!` | +| دیدگاه سندی بیرونی | `///` | +| دیدگاه چندخطی | `/*...*/` | | دیدگاه سندی چندخطی درونی | `/*!...*/` | | دیدگاه سندی چندخطی بیرونی | `/**...*/` | @@ -168,34 +168,34 @@ جدول ب-۸: چندتایی‌ها -| شرح | نماد | -|--------------------------------------------------------------------------------------|--------------------------| -| چندتایی خالی (یا واحد)، هم نحو و هم نوع | `()` | -| عبارت داخل کمانه | `(expr)` | -| عبارت چندتایی تک‌ عنصری | `(expr,)` | -| نوع داده ی چندتایی تک عنصری | `(type,)` | -| عبارت چندتایی | `(expr, ...)` | -| نوع داده ی چندتایی | `(type, ...)` | +| شرح | نماد | +|-------------------------------------------------------------------------------------:|--------------------------| +| چندتایی خالی (یا واحد)، هم نحو و هم نوع | `()` | +| عبارت داخل کمانه | `(expr)` | +| عبارت چندتایی تک عنصری | `(expr,)` | +| نوع داده ی چندتایی تک عنصری | `(type,)` | +| عبارت چندتایی | `(expr, ...)` | +| نوع داده ی چندتایی | `(type, ...)` | | بیان فراخوانی تابع. همچنین برای مقداردهی اولیه `struct` و تاپل `enum` استفاده می شود | `expr(expr, ...)` | -| نمایه‌سازی چندتایی | `expr.0`, `expr.1`, etc. | +| نمایه سازی چندتایی | `expr.0`, `expr.1`, etc. | -Table B-9 shows the contexts in which curly braces are used. +جدول ب-۹ زمینه‌های استفاده از آکولاد را نشان می‌دهد. -Table B-9: Curly Brackets +جدول ب-۹: آکولادها -| Context | Explanation | -|--------------|------------------| -| `{...}` | Block expression | -| `Type {...}` | `struct` literal | +| شرح | زمینه | +|----------------------:|--------------| +| عبارت بلوک | `{...}` | +| واژه ی کلیدی `struct` | `Type {...}` | -Table B-10 shows the contexts in which square brackets are used. +جدول ب-۱۰ زمینه‌هایی را نشان می‌دهد که در آن کروشه‌ها استفاده می‌‌شود. -Table B-10: Square Brackets +جدول ب-۱۰: کروشه‌ها -| Context | Explanation | -|----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------| -| `[...]` | Array literal | -| `[expr; len]` | Array literal containing `len` copies of `expr` | -| `[type; len]` | Array type containing `len` instances of `type` | -| `expr[expr]` | Collection indexing. Overloadable (`Index`, `IndexMut`) | -| `expr[..]`, `expr[a..]`, `expr[..b]`, `expr[a..b]` | Collection indexing pretending to be collection slicing, using `Range`, `RangeFrom`, `RangeTo`, or `RangeFull` as the “index” | +| شرح | زمینه | +|--------------------------------------------------------------------------------------------------------------------------------------------:|----------------------------------------------------| +| کلمه کلیدی Array | `[...]` | +| آرایه دقیق دارنده ی رونوشت به اندازه ی «len» از «expr» | `[expr; len]` | +| آرایه از نوع «type» به اندازه ی «len» | `[type; len]` | +| نمایه سازی مجموعه ی قابل بارگیری مجدد از ("Index"، "IndexMut") | `expr[expr]` | +| نمایه سازی مجموعه که نشان می دهد زیرمجموعه ای از مجموعه است با استفاده از «Range»، «RangeTo»، «RangeFrom» و یا «RangeFull» به عنوان «نمایه» | `expr[..]`, `expr[a..]`, `expr[..b]`, `expr[a..b]` |