diff --git a/src/one_to_many.rs b/src/one_to_many.rs index c17f9c2..f986b30 100644 --- a/src/one_to_many.rs +++ b/src/one_to_many.rs @@ -42,6 +42,14 @@ where self.right_to_left.get(right) } + pub fn first_left_and_rights(&self) -> Option<(&Left, &BTreeSet)> { + self.left_to_rights.first_key_value() + } + + pub fn last_left_and_rights(&self) -> Option<(&Left, &BTreeSet)> { + self.left_to_rights.last_key_value() + } + pub fn remove_left(&mut self, left: &Left) -> Option<(Left, BTreeSet)> { let (left, rights) = self.left_to_rights.remove_entry(left)?;