Skip to content

Commit

Permalink
fixes #198 - allow removing items from TypeMap
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartbeaumont committed Dec 24, 2023
1 parent 6b56127 commit cab26b1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/type/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ impl TypeMap {
self.map.len()
}

pub fn contains_key(&self, sid: SpectaID) -> bool {
self.map.contains_key(&sid)
}

pub fn remove(&mut self, sid: SpectaID) -> Option<NamedDataType> {
self.map.remove(&sid).flatten()
}

// TODO: It would be nice if this would a proper `Iterator` or `IntoIterator` implementation!
pub fn iter(&self) -> impl Iterator<Item = (SpectaID, &NamedDataType)> {
#[allow(clippy::unnecessary_filter_map)]
Expand Down

0 comments on commit cab26b1

Please sign in to comment.