I'm trying to define a struct with a clonable iterator object. So far, I've reached to:
pub struct UseClonableIterator2<'a,T:'a> {
it: &'a (Iterator<Item=T> + Clone)
}
Which does not compile because Clone
is not a "builtin trait":
x.rs:2:33: 2:38 error: only the builtin traits can be used as closure or object bounds [E0225]
x.rs:2 it: &'a (Iterator<Item=T> + Clone)
^~~~~
x.rs:2:33: 2:38 help: run `rustc --explain E0225` to see a detailed explanation
One option might be to add another type parameter for the Iterator, but this complicates definitions and I'd rather avoid it.