Skip to content

Commit

Permalink
Add an enumerate iterator for data directories
Browse files Browse the repository at this point in the history
  • Loading branch information
daladim committed Sep 27, 2021
1 parent 37d68d0 commit 0382c4c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/read/pe/data_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ impl<'data> DataDirectories<'data> {
self.entries.iter()
}

/// Iterator which gives the directories as well as their index (one of the IMAGE_DIRECTORY_ENTRY_* constants).
pub fn enumerate(&self) -> core::iter::Enumerate<slice::Iter<'data, pe::ImageDataDirectory>> {
self.entries.iter().enumerate()
}

/// Returns the data directory at the given index.
///
/// Index should be one of the `IMAGE_DIRECTORY_ENTRY_*` constants.
Expand Down

0 comments on commit 0382c4c

Please sign in to comment.