Skip to content

Commit

Permalink
multiboot2: ElfSectionIter: implement ExactSizeIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
phip1611 committed Oct 21, 2024
1 parent e0bc758 commit 4c6f7f9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions multiboot2/src/elf_sections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,19 @@ impl<'a> Iterator for ElfSectionIter<'a> {
}
None
}

fn size_hint(&self) -> (usize, Option<usize>) {
(
self.remaining_sections as usize,
Some(self.remaining_sections as usize),
)
}
}

impl ExactSizeIterator for ElfSectionIter<'_> {
fn len(&self) -> usize {
self.remaining_sections as usize
}
}

impl Debug for ElfSectionIter<'_> {
Expand Down

0 comments on commit 4c6f7f9

Please sign in to comment.