Skip to content

Commit

Permalink
pe: expose original bytes field via function
Browse files Browse the repository at this point in the history
There's no reason to render it as private, this enable a user to peek inside
the raw structure and perform more complicated reading without holding
the original bytes around.

Nonetheless, we expose it via a function to make it easier to deprecate
it or modify as we need.
  • Loading branch information
RaitoBezarius authored and raito committed Feb 12, 2024
1 parent 1e43fd6 commit 34af3a0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ pub struct PE<'a> {
}

impl<'a> PE<'a> {
/// Returns a view in the raw bytes of this PE binary
pub fn bytes(&self) -> &'a [u8] {
self.bytes
}

/// Reads a PE binary from the underlying `bytes`
pub fn parse(bytes: &'a [u8]) -> error::Result<Self> {
Self::parse_with_opts(bytes, &options::ParseOptions::default())
Expand Down

0 comments on commit 34af3a0

Please sign in to comment.