Closed sergeyfedotov closed 7 years ago
Hmm, that is a good point. Does changing &'a mut self
to &mut self
fix this problem? It should be safe.
Note that in your example, you can just call self.events.insert()
directly, without going through a cursor.
I had a look at the implementation of CursorMut::insert
. It might be possible to make it work, but it would require using unsafe code and I am not sure if the code will remain sound.
Note that in your example, you can just call self.events.insert() directly, without going through a cursor.
Actually I want to insert the items inside the loop like this:
let mut cur = self.events.front_mut();
loop {
match cur.get() {
Some(_) => {
// ...
cur.insert(Box::new(EventNode::new(OneRootPoint::new(x, y))));
},
_ => break,
}
cur.move_next();
}
Is this a possible use case?
Fixed in 0.6.3
Thanks!
Are there any reasons to specify insert method with the same lifetime as for CursorMut itself?
https://github.com/Amanieu/intrusive-rs/blob/70fef1fe156cdd5035d78e37c12fbf614999e0c4/src/rbtree.rs#L787