How to use type aliases

Use the type keyword to create a readable alias for existing types in Rust.

Use the type keyword to create an alias for an existing type, allowing you to use the new name interchangeably with the original. This improves readability and simplifies complex type signatures.

type Kilometers = u32;

fn main() {
    let distance: Kilometers = 100;
    println!("Distance: {}", distance);
}