Skip to content

Commit

Permalink
read/elf: impl Iterator for NoteIterator (#713)
Browse files Browse the repository at this point in the history
  • Loading branch information
yshui authored Aug 3, 2024
1 parent b138dab commit 8a25b8e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/read/elf/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ where
}
}

impl<'data, Elf: FileHeader> Iterator for NoteIterator<'data, Elf> {
type Item = read::Result<Note<'data, Elf>>;
fn next(&mut self) -> Option<Self::Item> {
match self.next() {
Err(e) => {
self.data = Bytes(&[]);
Some(Err(e))
}
Ok(Some(v)) => Some(Ok(v)),
Ok(None) => None,
}
}
}

/// A parsed [`NoteHeader`].
#[derive(Debug)]
pub struct Note<'data, Elf>
Expand Down

0 comments on commit 8a25b8e

Please sign in to comment.