1
Fork 0

Use IndexVec for coroutine local mapping

This commit is contained in:
Liu Dingming 2024-07-04 04:52:01 +08:00
parent 2db4ff40af
commit a9194f30eb
2 changed files with 21 additions and 19 deletions

View file

@ -208,6 +208,11 @@ impl<I: Idx, T> IndexVec<I, Option<T>> {
pub fn remove(&mut self, index: I) -> Option<T> {
self.get_mut(index)?.take()
}
#[inline]
pub fn contains(&self, index: I) -> bool {
self.get(index).and_then(Option::as_ref).is_some()
}
}
impl<I: Idx, T: fmt::Debug> fmt::Debug for IndexVec<I, T> {