Skip to content

Commit 0382c4c

Browse files
committed
Add an enumerate iterator for data directories
1 parent 37d68d0 commit 0382c4c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/read/pe/data_directory.rs

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ impl<'data> DataDirectories<'data> {
3535
self.entries.iter()
3636
}
3737

38+
/// Iterator which gives the directories as well as their index (one of the IMAGE_DIRECTORY_ENTRY_* constants).
39+
pub fn enumerate(&self) -> core::iter::Enumerate<slice::Iter<'data, pe::ImageDataDirectory>> {
40+
self.entries.iter().enumerate()
41+
}
42+
3843
/// Returns the data directory at the given index.
3944
///
4045
/// Index should be one of the `IMAGE_DIRECTORY_ENTRY_*` constants.

0 commit comments

Comments
 (0)