4 ms·
> because then you couldn't name the actual type I'm sure you know this, but `type Alias = impl Trait;` is on its way which would make naming those possible.
by estebank 5y ago
> because then you couldn't name the actual type
I'm sure you know this, but `type Alias = impl Trait;` is on its way which would make naming those possible.
- sanxiyn 5y agoFor posterity, this is Rust RFC 2515 type_alias_impl_trait.
- tialaramex 5y agoAlthough that's true, and potentially useful as a feature (not sure I want it, but pretty sure I wouldn't be angry if it was added).. I don't think that's what your parent was talking about when they say "couldn't name the actual type". They're saying, suppose I have a function that says it return an Iterator and I realise ah, it's not really returning an Iterator, but some subtype of Iterator - or, in Rust where subtypes don't exist, a type which merely implements Iterator. I now can't talk about the actual type being returned, because that's hidden from me, and it needn't be.