@@ -115,12 +115,9 @@ We can now return closures by value, just like any other type!
115
115
## More details
116
116
117
117
The above is all you need to know to get going with ` impl Trait ` , but for
118
- some more nitty-gritty details: type parameters and ` impl Trait ` in argument
119
- position are universals (universally quantified types). Meanwhile, `impl
120
- Trait` in return position are existentials (existentially quantified types).
121
- Okay, maybe that's a bit too jargon-heavy. Let's step back.
122
-
123
- Consider this function:
118
+ some more nitty-gritty details: type parameters and ` impl Trait ` work
119
+ slightly differently when they're in argument position versus return
120
+ position. Consider this function:
124
121
125
122
``` rust,ignore
126
123
fn foo<T: Trait>(x: T) {
@@ -157,10 +154,9 @@ type... anyway, you can see how `F` is in the return position here. So you
157
154
have the ability to choose.
158
155
159
156
With ` impl Trait ` , you're saying "hey, some type exists that implements this
160
- trait, but I'm not gonna tell you what it is." ("existential" in the jargon,
161
- "some type exists"). So now, the caller can't choose, and the function itself
162
- gets to choose. If we tried to define parse with ` Result<impl F,... ` as the
163
- return type, it wouldn't work.
157
+ trait, but I'm not gonna tell you what it is.". So now, the caller can't
158
+ choose, and the function itself gets to choose. If we tried to define parse
159
+ with ` Result<impl F,... ` as the return type, it wouldn't work.
164
160
165
161
### Using ` impl Trait ` in more places
166
162
0 commit comments