I want to write a function that accepts Iterator
of type that has ToString
trait.
What I have in mind:
fn parse<T: Iterator /* ?T::Item : ToString? */>(mut args: T) -> Result<String, String> {
match args.next() {
Some(x) => x.to_string(),
None => String::from("Missing parameter"),
}
}
<T as Iterator>::Item
part called? I was not able to google it, since I was probably missing the correct terminology. – Calgary