core/helper: Add PrimitiveDefinitionIds::iter

David Mak 2024-03-27 12:10:22 +08:00
parent 160cfa500a
commit d47c18bdcb
1 changed files with 6 additions and 1 deletions

View File

@ -45,10 +45,15 @@ impl PrimitiveDefinitionIds {
]
}
/// Returns an iterator over all [`DefinitionId`]s of this instance.
pub fn iter(&self) -> impl Iterator<Item=DefinitionId> {
self.as_vec().into_iter()
}
/// Returns the primitive with the largest [`DefinitionId`].
#[must_use]
pub fn max_id(&self) -> DefinitionId {
self.as_vec().into_iter().max().unwrap()
self.iter().max().unwrap()
}
}