Amanieu / intrusive-rs

Intrusive collections for Rust
Apache License 2.0
400 stars 47 forks source link

Order considerations for rbtree::CursorMut::replace_with? #2

Closed emberian closed 8 years ago

emberian commented 8 years ago

Does this function have any order considerations? That is, does the replaced object need to have the same sort order as the object being replaced? Either way, I think the answer should be in the rustdocs.

Amanieu commented 8 years ago

Thanks! I seem to have forgotten about this when writing the docs.

There are ordering considerations in that violating the order can make find, upper_bound, lower_bound and range return incorrect results, however this isn't unsafe because this does not impact memory safety.

Note that the same applies to CursorMut::insert_{before,after}.