Scalar Type
- A scalar type represents a single value.
- Rust has four primary scalar types: integers, floating-point numbers, Booleans, and characters.
Character Type
charliterals with single quotes, as opposed to string literals, which use double quotes- Rust’s
chartype is four bytes in size and represents a Unicode Scalar Value, which means it can represent a lot more than just ASCII. Accented letters; Chinese, Japanese, and Korean characters; emoji; and zero-width spaces are all validcharvalues in Rust. Unicode Scalar Values range fromU+0000toU+D7FFandU+E000toU+10FFFFinclusive
Compound Type
Compound types can group multiple values into one type. Rust has two primitive compound types: tuples and arrays.
Tuple
- Tuples have a fixed length: once declared, they cannot grow or shrink in size.
Array
- Unlike a tuple, every element of an array must have the same type
- Arrays are useful when you want your data allocated on the stack rather than the heap.
- An array isn’t as flexible as the vector type, though. A vector is a similar collection type provided by the standard library that is allowed to grow or shrink in size