File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,16 @@ let one_to_one_hundred = range(1, 101).collect::<Vec<i32>>();
132132```
133133
134134If you remember, the ` ::<> ` syntax allows us to give a type hint,
135- and so we tell it that we want a vector of integers.
135+ 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.
136145
137146` collect() ` is the most common consumer, but there are others too. ` find() `
138147is one:
You can’t perform that action at this time.
0 commit comments