A where clause in function type?


#1

Hi all,

I’m reading some real rust code from github and found a function defined as: fn load<T>(&mut self, iter: T) where T: Iterator<Item = &'a String>. According to the comment and its expected behavior, I would suppose that where T: Iterator<Item = &'a String> is considered as a part of the function type. However, I cannot find this kind of function definition mentioned in the reference. Could anyone help me to explain it? It would be also better if there’s any official document (an RFC?) mentioned this kind of use.

Moreover, is there any good place which covers almost all rust syntax? I’m currently learning rust through rustbyexample the official guide, occasionally, I read the reference if something is not quite clear to me. However, it seems that these three sources combined could not cover some rust syntax. Unfortunately, I really do not have time to follow all/major RFCs, is there any other place that I could get a summary of rust’s syntax?


#2

Never mind. It’s mentioned here.


#3

http://doc.rust-lang.org/book/traits.html#where-clause

There is not currently a single place that documents everything, sorry :confused:
working on it. And there are some things that still have basically no
documentation at all.