diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2023-03-29 14:31:32 +0200 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2023-03-29 14:49:06 +0200 |
| commit | bea1c71f833ad9b8dacd98b1f950000ff9ab2f74 (patch) | |
| tree | 19d22f00822f116eac78ea7ed1ffe07e8d6536ff /lib | |
| parent | 7a98e24777d127c8d3cdb322aa7e9ea4f4dba5e3 (diff) | |
| download | rust-bea1c71f833ad9b8dacd98b1f950000ff9ab2f74.tar.gz rust-bea1c71f833ad9b8dacd98b1f950000ff9ab2f74.zip | |
Use struct_tail_without_normalization in Expectation::rvalue_hint
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/la-arena/src/map.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/la-arena/src/map.rs b/lib/la-arena/src/map.rs index 7fff2b09c97..610f7d92d65 100644 --- a/lib/la-arena/src/map.rs +++ b/lib/la-arena/src/map.rs @@ -72,17 +72,17 @@ impl<T, V> ArenaMap<Idx<T>, V> { } /// Returns an iterator over the values in the map. - pub fn values(&self) -> impl Iterator<Item = &V> { + pub fn values(&self) -> impl Iterator<Item = &V> + DoubleEndedIterator { self.v.iter().filter_map(|o| o.as_ref()) } /// Returns an iterator over mutable references to the values in the map. - pub fn values_mut(&mut self) -> impl Iterator<Item = &mut V> { + pub fn values_mut(&mut self) -> impl Iterator<Item = &mut V> + DoubleEndedIterator { self.v.iter_mut().filter_map(|o| o.as_mut()) } /// Returns an iterator over the arena indexes and values in the map. - pub fn iter(&self) -> impl Iterator<Item = (Idx<T>, &V)> { + pub fn iter(&self) -> impl Iterator<Item = (Idx<T>, &V)> + DoubleEndedIterator { self.v.iter().enumerate().filter_map(|(idx, o)| Some((Self::from_idx(idx), o.as_ref()?))) } @@ -96,7 +96,7 @@ impl<T, V> ArenaMap<Idx<T>, V> { /// 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)> { + pub fn into_iter(self) -> impl Iterator<Item = (Idx<T>, V)> + DoubleEndedIterator { self.v.into_iter().enumerate().filter_map(|(idx, o)| Some((Self::from_idx(idx), o?))) } |
