Rust-reference/types/inferred

来自菜鸟教程
跳转至:导航、​搜索

Inferred type

自动推断型类型

parameters.md

commit: 43dc1a42f19026f580e34a095e91804c3d6da186
本章译文最后维护日期:2020-11-14

句法

InferredType : _

自动推断型类型要求编译器尽可能根据周围可用的信息推断出实际使用类型。它不能用于程序项的签名中。它经常用于泛型参数中:

let x: Vec<_> = (0..10).collect();