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_

推断类型 要求 编译器 根据可用的周边信息尽可能地推断类型。

例子

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

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

推断类型 不能用于 项 签名。