Type aliases in Rust create a shorthand name for an existing type using the `type` keyword to improve code readability.
Type aliases in Rust let you create a shorthand name for an existing type using the type keyword. This improves code readability and reduces repetition when dealing with complex or long type signatures.
type Kilometers = f64;
fn distance(km: Kilometers) {
println!("Distance: {} km", km);
}
A type alias is like giving a nickname to a long or complicated name so you don't have to type it out every time. It doesn't create a new type; it just gives the existing one a shorter, more descriptive label. Think of it as labeling a heavy box "Fragile" instead of writing the full contents list on every shipping form.