I am trying to implement a struct composed of a generic field which type must implement the non-consuming "iter" method (see below).
struct Node<T> {
key: T
}
impl<T> Node<T> where T: ?? {
fn do_stuff(&self) {
for e in self.key.iter() {
/* ... */
}
}
}
fn main() {
let n1 = Node { key: "foo".to_owned() };
n1.do_stuff();
let n2 = Node { key: vec![1, 2, 3] };
n2.do_stuff();
}
Which trait bound should I associate with the parameter T?