Amanieu / intrusive-rs

Intrusive collections for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RBTree find/*_bound methods keep borrow of the key

fominok opened this issue · comments

Hi,
While using RBTree I faced a problem with a simple scenario: I'm trying to do a kind of search to create a cursor with lower_bound_mut using a reference as an argument and then to insert_after using a value I searched by before; the problem is that the value is still borrowed even the cursor is already created and I see no reason to keep this borrow.

I would just insert it but I want to keep items unique so I do search with optional insertion .

UPD: also I noticed that .get operation on CursorMut returns a reference with a lifetime tied to cursor's lt rather than the tree's one, however, for Cursor is seems to be done correctly , but I may have wrong assumptions about lifetimes and soundness for CursorMut, anyway it would be nice to hear back if I'm using it wrong

All of these issues are now resolved