🔔 Prelude: In the end, all data types in Rust come from these primitive types.
Basic types Every value in Rust has a specific data type In general, these can be divided into two categories: scalar types and compound types Scalar types include: Numbers: Signed integers (i8, i16, i32, i64, isize), unsigned integers (u8, u16, u32, u64, usize), floating-point numbers (f32, f64) The isize and usize types depend on the architecture of the computer the program is running on: if the CPU is 32-bit, these types are 32-bit; similarly, if the CPU is 64-bit, they are Rust’s default integer type is i32 Can overflow, and Rust does not check for this by default. If you encounter incorrect values, make sure to check the type of your numbers. Strings: String literals and string slices Booleans: true and false Characters: Representing a single Unicode character, stored as 4 bytes Unit type: Represented by (), with its only value also being () Be Careful with floats See this example:
...