Skip to content

Commit

Permalink
fix implmentations of ExactSizeIterator::len()
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed May 28, 2024
1 parent d2e5181 commit 2d99e16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions capnp/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl<U, T: IndexMove<u32, U>> ::core::iter::Iterator for ListIter<T, U> {

impl<U, T: IndexMove<u32, U>> ::core::iter::ExactSizeIterator for ListIter<T, U> {
fn len(&self) -> usize {
self.size as usize
self.size as usize - self.index as usize
}
}

Expand Down Expand Up @@ -234,7 +234,7 @@ impl<U, T: IndexMove<u16, U>> ::core::iter::Iterator for ShortListIter<T, U> {

impl<U, T: IndexMove<u16, U>> ::core::iter::ExactSizeIterator for ShortListIter<T, U> {
fn len(&self) -> usize {
self.size as usize
self.size as usize - self.index as usize
}
}

Expand Down

0 comments on commit 2d99e16

Please sign in to comment.