Basic Data Type
Primitive
- signed integers: i8, i16, i32, i64, i128 and isize (pointer size)
- unsigned integers: u8, u16, u32, u64, u128 and usize (pointer size)
- floating point: f32, f64
- char Unicode scalar values like ‘a’, ‘α’ and ‘∞’ (4 bytes each)
- bool either true or false
- unit type (), whose only possible value is an empty tuple: ()
Compound
- arrays like [1, 2, 3]
- tuples like (1, true)
Defining and Instantiating Structs -> Class
User Structs
1 | struct User { |