pub struct ByteReader<'a> { /* private fields */ }Implementations§
Source§impl<'a> ByteReader<'a>
impl<'a> ByteReader<'a>
Sourcepub fn new(bytes: &'a [u8]) -> Self
pub fn new(bytes: &'a [u8]) -> Self
Creates a new ByteReader over the specified bytes.
Sourcepub fn new_with_rel(bytes: &'a [u8], pos: usize) -> Self
pub fn new_with_rel(bytes: &'a [u8], pos: usize) -> Self
Creates a new relative ByteReader over the specified bytes.
All operations including RVA’s will be relative to the specified position.
Sourcepub fn bytes(&self) -> &'a [u8] ⓘ
pub fn bytes(&self) -> &'a [u8] ⓘ
Returns a reference to the bytes of this ByteReader.
Sourcepub fn remaining_bytes(&self) -> &'a [u8] ⓘ
pub fn remaining_bytes(&self) -> &'a [u8] ⓘ
Returns a reference to the remaining bytes of this ByteReader.
Sourcepub fn bytes_at(&self, pos: usize) -> Result<&'a [u8]>
pub fn bytes_at(&self, pos: usize) -> Result<&'a [u8]>
Returns a reference to the bytes of this ByteReader, starting at the specified position
§Errors
This function will return Error::InsufficientBuffer
if the specified position is outside of the buffers bounds.
Sourcepub fn rel_pos(&self) -> Option<usize>
pub fn rel_pos(&self) -> Option<usize>
Returns the relative position set by ByteReader::new_with_rel of this ByteReader.
Sourcepub fn pos_to_rel(&self, pos: usize) -> usize
pub fn pos_to_rel(&self, pos: usize) -> usize
Converts the specified RVA to a position within the buffer
Sourcepub fn skip_to(&mut self, pos: Pos) -> &mut Self
pub fn skip_to(&mut self, pos: Pos) -> &mut Self
Advances the internal data buffer to the specified position
Auto Trait Implementations§
impl<'a> Freeze for ByteReader<'a>
impl<'a> RefUnwindSafe for ByteReader<'a>
impl<'a> Send for ByteReader<'a>
impl<'a> Sync for ByteReader<'a>
impl<'a> Unpin for ByteReader<'a>
impl<'a> UnsafeUnpin for ByteReader<'a>
impl<'a> UnwindSafe for ByteReader<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more