Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

推断类型

Syntax
InferredType_

推断类型要求编译器根据可用的周围信息推断类型(如果可能)。

Example

推断类型通常用于泛型参数:

#![allow(unused)]
fn main() {
let x: Vec<_> = (0..10).collect();
}

推断类型不能在项签名中使用。