pub struct Reader<'a> {
pub offset: usize,
/* private fields */
}Expand description
Sequential reader borrowing a byte slice.
Fields§
§offset: usizeCurrent byte offset.
Implementations§
Source§impl<'a> Reader<'a>
impl<'a> Reader<'a>
Sourcepub fn raw(&mut self, size: usize) -> Result<&'a [u8]>
pub fn raw(&mut self, size: usize) -> Result<&'a [u8]>
Read a bounded range, returning an error rather than panicking.
Sourcepub fn fail<T>(&self, message: impl Into<String>) -> Result<T>
pub fn fail<T>(&self, message: impl Into<String>) -> Result<T>
Construct a diagnostic at the current position.
Sourcepub fn u32(&mut self) -> Result<u32>
pub fn u32(&mut self) -> Result<u32>
Read an unsigned word, also usable for exact f32 storage bits.
Sourcepub fn count(&mut self, maximum: usize, stride: usize) -> Result<usize>
pub fn count(&mut self, maximum: usize, stride: usize) -> Result<usize>
Read a nonnegative count bounded by both policy and available storage.
Auto Trait Implementations§
impl<'a> Freeze for Reader<'a>
impl<'a> RefUnwindSafe for Reader<'a>
impl<'a> Send for Reader<'a>
impl<'a> Sync for Reader<'a>
impl<'a> Unpin for Reader<'a>
impl<'a> UnsafeUnpin for Reader<'a>
impl<'a> UnwindSafe for Reader<'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