feat: get first or last element of OneToManyUniqueBTreeMap

This commit is contained in:
2026-05-20 22:02:44 -04:00
parent c04338155b
commit 4ed8d6d241

View File

@@ -42,6 +42,14 @@ where
self.right_to_left.get(right)
}
pub fn first_left_and_rights(&self) -> Option<(&Left, &BTreeSet<Right>)> {
self.left_to_rights.first_key_value()
}
pub fn last_left_and_rights(&self) -> Option<(&Left, &BTreeSet<Right>)> {
self.left_to_rights.last_key_value()
}
pub fn remove_left(&mut self, left: &Left) -> Option<(Left, BTreeSet<Right>)> {
let (left, rights) = self.left_to_rights.remove_entry(left)?;