MSVC prerequisites - The rustup book
To compile programs into an exe file, Rust requires a linker, libraries and Windows API import libraries. For msvc targets these can be acquired through Visual Studio.
了解一个语言的方法是翻译一份文档
讨论Rust安装,常规`Hello Rust!`,使用名为`cargo`的Rust构建系统和包管理器
MSVC prerequisites - The rustup book
To compile programs into an exe file, Rust requires a linker, libraries and Windows API import libraries. For msvc targets these can be acquired through Visual Studio.
crates.io
Length | Signed | Unsigned |
8-bit | i8 | u8 |
16-bit | i16 | u16 |
32-bit | i32 | u32 |
64-bit | i64 | u64 |
128-bit | i128 | u128 |
Architecture-dependent | isize | usize |
Number literals | Example |
Decimal | 98_222 |
Hex | 0xff |
Octal | 0o77 |
Binary | 0b1111_0000 |
Byte ( u8 only) | b'A' |
f32 和 f64true 和 falseOperator | Example | Explanation | Overloadable? |
! | ident!(...), ident!{...}, ident![...] | Macro expansion | ㅤ |
! | !expr | Bitwise or logical complement | Not |
!= | expr != 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 | Short-circuiting logical AND | ㅤ |
* | expr * expr | Arithmetic multiplication | Mul |
*= | var *= expr | Arithmetic multiplication and assignment | MulAssign |
* | *expr | Dereference | Deref |
* | *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 | Field access | ㅤ |
. | expr.ident(expr, ...) | Method call | ㅤ |
. | expr.0, expr.1, and so on | Tuple indexing | ㅤ |
.. | .., expr.., ..expr, expr..expr | Right-exclusive range literal | PartialOrd |
..= | ..=expr, expr..=expr | Right-inclusive range literal | PartialOrd |
.. | ..expr | Struct literal update syntax | ㅤ |
.. | variant(x, ..), struct_type { x, .. } | “And the rest” pattern binding | ㅤ |
... | expr...expr | (Deprecated, use ..= instead) 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 | Short-circuiting logical OR | ㅤ |
? | expr? | Error propagation | ㅤ |
(1..4) 是半开区间 1,2,3;rev() 可反转迭代顺序值 => 表达式 的形式,最后一个分支常用 _ 作为兜底