- Primitive types:
- Sequence types:
- User-defined types:
- Function types:
- Pointer types:
- Trait types:
- Rust String
usize
: sizeof pointer- Owned Types
- variables that contain the actual values they represent
- move types
- Borrowed Types
- addresses of the values they represent
Type alias
Replace empty struct
with type alias
type Kilometers = i32;
let x: i32 = 5;
let y: Kilometers = 5;
println!("x + y = {}", x + y);