pub struct SnapReader<'a> {
pub data: &'a [u8],
pub cursor: usize,
pub ok: bool,
}Expand description
Bounds-checked little-endian reader over a snapshot image. A short or
corrupt image trips ok instead of panicking, mirroring the C
b2SnapReader contract. (b2SnapReader)
Fields§
§data: &'a [u8]§cursor: usize§ok: boolImplementations§
Source§impl<'a> SnapReader<'a>
impl<'a> SnapReader<'a>
pub fn new(data: &'a [u8]) -> SnapReader<'a>
pub fn r_u16(&mut self) -> u16
pub fn r_u32(&mut self) -> u32
pub fn r_i32(&mut self) -> i32
pub fn r_u64(&mut self) -> u64
pub fn r_f32(&mut self) -> f32
pub fn r_f64(&mut self) -> f64
pub fn r_bool(&mut self) -> bool
pub fn r_u8(&mut self) -> u8
Sourcepub fn check_count(&mut self, count: i32, min_stream_bytes: usize) -> bool
pub fn check_count(&mut self, count: i32, min_stream_bytes: usize) -> bool
Guard an element count against the remaining stream so a corrupt count cannot force a huge allocation. (b2SnapCheckCount)
pub fn r_header(&mut self) -> SnapHeader
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for SnapReader<'a>
impl<'a> RefUnwindSafe for SnapReader<'a>
impl<'a> Send for SnapReader<'a>
impl<'a> Sync for SnapReader<'a>
impl<'a> Unpin for SnapReader<'a>
impl<'a> UnsafeUnpin for SnapReader<'a>
impl<'a> UnwindSafe for SnapReader<'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