Skip to content

Commit 9d27cb3

Browse files
committed
dir/gen2: add name() helper to Entry
Signed-off-by: Daniel Maslowski <[email protected]>
1 parent b63b512 commit 9d27cb3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/dir/gen2.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ impl Entry {
104104
data_end,
105105
}
106106
}
107+
108+
pub fn name(&self) -> String {
109+
match std::str::from_utf8(&self.name) {
110+
Ok(n) => n.trim_end_matches('\0').to_string(),
111+
Err(_) => format!("{:02x?}", &self.name),
112+
}
113+
}
107114
}
108115

109116
impl Display for BinaryMap {

0 commit comments

Comments
 (0)