Show Menu
Cheatography

Rust Basics Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Variables / Assignment

let i = 1i;
let hello = "­wor­ld";
let mut canChange = 2;
canChange += 1;
 

Integer Literals

Decimal
1234 or 1_234
Hex
0xffff or 0xff_ff
Octal
0o7777 or 0o77_77
Binary
0b11111111 or 0b1111­_1111
Byte (u8 only)
b'A'
 

Integer Types

Length
Signed
Unsigned
8-bit int
i8
u8
16-bit int
i16
u16
32-bit int
i32
u32
64-bit int
i64
u64
arch int
isize
usize