We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ed58399 + 6647d83 commit 8111d65Copy full SHA for 8111d65
src/doc/trpl/iterators.md
@@ -132,7 +132,16 @@ let one_to_one_hundred = (1..101i32).collect::<Vec<i32>>();
132
```
133
134
If you remember, the `::<>` syntax allows us to give a type hint,
135
-and so we tell it that we want a vector of integers.
+and so we tell it that we want a vector of integers. You don't always
136
+need to use the whole type, though. Using a `_` will let you provide
137
+a partial hint:
138
+
139
+```rust
140
+let one_to_one_hundred = range(1, 101).collect::<Vec<_>>();
141
+```
142
143
+This says "Collect into a `Vec<T>`, please, but infer what the `T` is for me."
144
+`_` is sometimes called a "type placeholder" for this reason.
145
146
`collect()` is the most common consumer, but there are others too. `find()`
147
is one:
0 commit comments