diff options
| author | hkalbasi <hamidrezakalbasi@protonmail.com> | 2023-02-26 16:04:41 +0330 |
|---|---|---|
| committer | hkalbasi <hamidrezakalbasi@protonmail.com> | 2023-03-06 21:09:09 +0330 |
| commit | ac04bfd7a7223cc7077f6745c35f8b655ea13c73 (patch) | |
| tree | fb993abefdda7f7673b7b715199119335eea4e1e /lib | |
| parent | a25710b0c01cc523b0f3732ca68321ac107a0ebe (diff) | |
| download | rust-ac04bfd7a7223cc7077f6745c35f8b655ea13c73.tar.gz rust-ac04bfd7a7223cc7077f6745c35f8b655ea13c73.zip | |
Add `View Mir` command and fix some bugs
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/la-arena/src/map.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/la-arena/src/map.rs b/lib/la-arena/src/map.rs index b9d491da3c0..7fff2b09c97 100644 --- a/lib/la-arena/src/map.rs +++ b/lib/la-arena/src/map.rs @@ -94,6 +94,12 @@ impl<T, V> ArenaMap<Idx<T>, V> { .filter_map(|(idx, o)| Some((Self::from_idx(idx), o.as_mut()?))) } + /// Returns an iterator over the arena indexes and values in the map. + // FIXME: Implement `IntoIterator` trait. + pub fn into_iter(self) -> impl Iterator<Item = (Idx<T>, V)> { + self.v.into_iter().enumerate().filter_map(|(idx, o)| Some((Self::from_idx(idx), o?))) + } + /// Gets the given key's corresponding entry in the map for in-place manipulation. pub fn entry(&mut self, idx: Idx<T>) -> Entry<'_, Idx<T>, V> { let idx = Self::to_idx(idx); |
