-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
skiplist: add compare_insert #976
Conversation
Signed-off-by: Tianion <[email protected]>
hhh... let map = SkipMap::new();
map.insert("key", 1);
map.compare_insert("key", 0, |x| x < &0);
assert_eq!(*map.get("key").unwrap().value(), 1);
map.compare_insert("key", 2, |x| x < &2);
assert_eq!(*map.get("key").unwrap().value(), 2); |
Thanks for the PR! CI failure should be fixed by rebasing. |
Could you also add a test for a case where the key is not present? (should work the same as Also, it would be nice to clarify in the documentation that the closure will not be called if the key is not present. |
The rustc version in the CI has been upgraded from 1.71 to 1.72, which resulted in CI/Clippy checks failing. I attempted to fix it, but there are certain issues below that I'm unsure how to address.
|
Could you remove (or revert) clippy-related commits? They have been addressed in #1021. |
Done,thanks for your detailed review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The purpose is support
compare and swap
/compare and exchange
.I notice that the function
insert_internal
is core function, so I changereplace
to support CAS