pub struct View<'a> { /* private fields */ }Expand description
A borrowed byte slice read at explicit offsets, with the file offset of its first byte for error reporting.
Implementations§
Source§impl View<'_>
impl View<'_>
Sourcepub fn u16(&self, offset: usize, e: Endian) -> Result<u16, BoundsError>
pub fn u16(&self, offset: usize, e: Endian) -> Result<u16, BoundsError>
The u16 at offset, in byte order e.
Sourcepub fn i16(&self, offset: usize, e: Endian) -> Result<i16, BoundsError>
pub fn i16(&self, offset: usize, e: Endian) -> Result<i16, BoundsError>
The i16 at offset, in byte order e.
Sourcepub fn u32(&self, offset: usize, e: Endian) -> Result<u32, BoundsError>
pub fn u32(&self, offset: usize, e: Endian) -> Result<u32, BoundsError>
The u32 at offset, in byte order e.
Sourcepub fn i32(&self, offset: usize, e: Endian) -> Result<i32, BoundsError>
pub fn i32(&self, offset: usize, e: Endian) -> Result<i32, BoundsError>
The i32 at offset, in byte order e.
Sourcepub fn u64(&self, offset: usize, e: Endian) -> Result<u64, BoundsError>
pub fn u64(&self, offset: usize, e: Endian) -> Result<u64, BoundsError>
The u64 at offset, in byte order e.
Sourcepub fn i64(&self, offset: usize, e: Endian) -> Result<i64, BoundsError>
pub fn i64(&self, offset: usize, e: Endian) -> Result<i64, BoundsError>
The i64 at offset, in byte order e.
Source§impl<'a> View<'a>
impl<'a> View<'a>
Sourcepub fn with_origin(data: &'a [u8], origin: usize) -> Self
pub fn with_origin(data: &'a [u8], origin: usize) -> Self
origin is the source byte offset of data[0]; slicing offsets remain local.
Sourcepub fn slice(
&self,
offset: usize,
length: usize,
) -> Result<&'a [u8], BoundsError>
pub fn slice( &self, offset: usize, length: usize, ) -> Result<&'a [u8], BoundsError>
The length bytes at offset.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Forget for View<'a>
impl<'a> Freeze for View<'a>
impl<'a> RefUnwindSafe for View<'a>
impl<'a> Send for View<'a>
impl<'a> Sync for View<'a>
impl<'a> Unpin for View<'a>
impl<'a> UnsafeUnpin for View<'a>
impl<'a> UnwindSafe for View<'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