pub struct Rd<'a> {
pub data: &'a [u8],
pub what: &'static str,
}Expand description
Bounds-checked fixed-size reads, little and big endian: every read past the end is an Error::Format that names
what and the offset.
Fields§
§data: &'a [u8]The bytes being read.
what: &'static strWhat they are, for error messages.
Implementations§
Source§impl<'a> Rd<'a>
impl<'a> Rd<'a>
Sourcepub fn new(data: &'a [u8], what: &'static str) -> Self
pub fn new(data: &'a [u8], what: &'static str) -> Self
Reads over data; what names the thing being read in every error.
Sourcepub fn size32le(&self, at: usize) -> Result<usize>
pub fn size32le(&self, at: usize) -> Result<usize>
The little-endian u32 at at as a size or count.
Sourcepub fn offset64le(&self, at: usize) -> Result<usize>
pub fn offset64le(&self, at: usize) -> Result<usize>
The little-endian u64 at at as an offset or size.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Rd<'a>
impl<'a> RefUnwindSafe for Rd<'a>
impl<'a> Send for Rd<'a>
impl<'a> Sync for Rd<'a>
impl<'a> Unpin for Rd<'a>
impl<'a> UnsafeUnpin for Rd<'a>
impl<'a> UnwindSafe for Rd<'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