Any specification for where clause?

I always though that it will be

where SOME_TYPE : SOME_BOUNDS

but the code shown in RustLatam 2019 - Florian Gilcher: The Power of the “Where” Clause strikes me:

fn takes_into_string<T>(t : T)
where String : From<T>
{
  ...
}

This makes generics more flexible and expressive !

Yes, check out the reference: https://doc.rust-lang.org/reference/items/generics.html#where-clauses

Where clauses provide an another way to specify bounds on type and lifetime parameters as well as a way to specify bounds on types that aren’t type parameters.

Check out the source code for typenum to see some of the crazy type level meta programming you can do.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.