pub struct Unpacker<'b> { /* private fields */ }Expand description
Reads a frame. Every read answers None for bytes that aren’t what
Packer writes there.
Implementations§
Source§impl<'b> Unpacker<'b>
impl<'b> Unpacker<'b>
Sourcepub fn open(bytes: &'b [u8]) -> Option<Self>
pub fn open(bytes: &'b [u8]) -> Option<Self>
The frame’s body and table found; the root value next.
pub fn get_u(&mut self) -> Option<u64>
pub fn get_i(&mut self) -> Option<i64>
pub fn get_bool(&mut self) -> Option<bool>
pub fn get_f64(&mut self) -> Option<f64>
pub fn get_f32(&mut self) -> Option<f32>
pub fn get_f64s(&mut self) -> Option<Vec<f64>>
Sourcepub fn get_uints<T>(&mut self, of: impl Fn(u64) -> Option<T>) -> Option<Vec<T>>
pub fn get_uints<T>(&mut self, of: impl Fn(u64) -> Option<T>) -> Option<Vec<T>>
Bit-packed numbers (Packer::put_uints), each made a T by of.
pub fn get_f32s(&mut self) -> Option<Vec<f32>>
Sourcepub fn packed_ints(&mut self) -> Option<(usize, u32, &'b [u8])>
pub fn packed_ints(&mut self) -> Option<(usize, u32, &'b [u8])>
A packed list of ints, unread: how many, bits each, their bytes.
Sourcepub fn packed_floats(&mut self, wide: bool) -> Option<(usize, bool, &'b [u8])>
pub fn packed_floats(&mut self, wide: bool) -> Option<(usize, bool, &'b [u8])>
A list of floats, unread: how many, whether they’re f32s, their
bytes. A list of f64 says whether it’s narrowed (wide); one of
f32 always is.
Sourcepub fn get_str(&mut self) -> Option<&'b str>
pub fn get_str(&mut self) -> Option<&'b str>
A string, borrowed from the frame: the table read as far as it’s needed.
A string as an Arc<str>: one allocation for every time the frame has it.
pub fn get_bytes(&mut self) -> Option<&'b [u8]>
Sourcepub fn get_tagged<T: Schema>(&mut self) -> Option<T>
pub fn get_tagged<T: Schema>(&mut self) -> Option<T>
A value held in its binary form (Packer::put_tagged).
Sourcepub fn list(&mut self) -> Option<(usize, usize)>
pub fn list(&mut self) -> Option<(usize, usize)>
A list (Packer::begin_list): how many items, and where it ends.
Sourcepub fn skip_to(&mut self, end: usize) -> Option<()>
pub fn skip_to(&mut self, end: usize) -> Option<()>
Steps to end (a list’s), past what’s left of it.
Auto Trait Implementations§
impl<'b> Freeze for Unpacker<'b>
impl<'b> RefUnwindSafe for Unpacker<'b>
impl<'b> Send for Unpacker<'b>
impl<'b> Sync for Unpacker<'b>
impl<'b> Unpin for Unpacker<'b>
impl<'b> UnsafeUnpin for Unpacker<'b>
impl<'b> UnwindSafe for Unpacker<'b>
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