From 0161742c590e829ec0d7652525c1aaf471349722 Mon Sep 17 00:00:00 2001 From: daladim Date: Tue, 28 Sep 2021 08:09:35 +0200 Subject: [PATCH] read/pe: add `DataDirectories::enumerate` (#384) --- src/read/pe/data_directory.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/read/pe/data_directory.rs b/src/read/pe/data_directory.rs index 7799487f..2e4ce21c 100644 --- a/src/read/pe/data_directory.rs +++ b/src/read/pe/data_directory.rs @@ -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> { + self.entries.iter().enumerate() + } + /// Returns the data directory at the given index. /// /// Index should be one of the `IMAGE_DIRECTORY_ENTRY_*` constants.