[<<][rust][>>][..]
Sun Apr 22 11:46:52 EDT 2018

Don't confuse traits (constraints) with trait objects (types)

Basically, in a type signature like

pub fn foo<T>

The 'T' is always a type.
T: Iterator<Item=_> 

What's after ':' is a type constraight such as a Trait bound, or a lifetype.
(where _ is some other type, not imporant)

Do not confuse this with:

pub fn foo<T> (arg: Iterator<Item=_>) -> { }

Where what's after arg: is a type, not a type constraint.
This is called a trait object.

It seems there is no way to express:

variable: <Type>: <Type constraint>

The constraint needs to go to where the type variable is declared.




[Reply][About]
[<<][rust][>>][..]