Type Aliases

https://doc.rust-lang.org/book/type-aliases.html

typeキーワードで型に別名をつけられる。C言語でいうtypedef

fn main() {
    type Name = String;
    let x: Name = "Hello".to_string();
    println!("{}", x);

    type Num = i32;
    let x: i32 = 5;
    let y: Num = 5;
    if x == y {
       println!("x == y");
    }
}
$ cargo run
   Compiling 4_28_type_aliases v0.1.0 (file:///Users/miura/work/git-work/exercises/The_Rust_Programming_Language/4_28_type_aliases)
    Finished debug [unoptimized + debuginfo] target(s) in 0.34 secs
     Running `target/debug/4_28_type_aliases`
Hello
x == y