我在一些Rust 的例子中看到了关键词type
,但我从来没有看到过它的解释.以下是我看到的几个例子:
impl Add<Foo> for Bar {
type Output = BarFoo;
// omitted
}
type T = HashMap<i32,String>; // Type arguments used in a type expression
let x = id::<i32>(10); // Type arguments used in a call expression
谁能解释一下这个关键词的作用吗?我在《铁 rust 举例》或《铁 rust 书》中找不到它.