Given example codes as
#[derive(Default)]
pub struct Worker<'a>{
v: Vec<i32>,
m: HashMap<String, std::slice::Iter<'a, i32>>
}
impl<'a> Worker<'a> {
pub fn new() -> Self {
Worker::default()
}
pub fn seti(&mut self) {
}
pub fn setm(&'a mut self) {
let v = self.v.iter();
self.m.insert("sf".to_string(), v);
}
pub fn hello(&'a mut self) {
self.setm();
self.seti();
}
}
where Worker.m
is used to store iterators produced by Worker.v
.
How to fix the broken codes above.
Desparate for help~