pub struct Packer { /* private fields */ }Expand description
Writes a frame.
Implementations§
Source§impl Packer
impl Packer
pub fn new() -> Self
pub fn put_i(&mut self, n: i64)
pub fn put_bool(&mut self, b: bool)
pub fn put_f64(&mut self, f: f64)
pub fn put_f32(&mut self, f: f32)
Sourcepub fn put_f64s(&mut self, items: &[f64])
pub fn put_f64s(&mut self, items: &[f64])
Floats, raw: a count, whether they’re kept as f32 (when every one
is one exactly — half the bytes), then each one’s bytes.
Sourcepub fn put_uints(
&mut self,
len: usize,
items: impl Iterator<Item = u64> + Clone,
)
pub fn put_uints( &mut self, len: usize, items: impl Iterator<Item = u64> + Clone, )
Unsigned numbers bit-packed: a count, how many bits each takes (the
biggest one’s, one at least), then the bits (lanes).
pub fn put_f32s(&mut self, items: &[f32])
Sourcepub fn put_str(&mut self, s: &str)
pub fn put_str(&mut self, s: &str)
A string: its index in the table, which gets it the first time.
pub fn put_bytes(&mut self, b: &[u8])
Sourcepub fn put_tagged<T: Schema>(&mut self, v: &T)
pub fn put_tagged<T: Schema>(&mut self, v: &T)
v in its binary form, as bytes: what a frame holds of a type that
doesn’t pack itself.
Sourcepub fn begin(&mut self) -> usize
pub fn begin(&mut self) -> usize
A record starts: where its length goes (Packer::end fills it in).
Sourcepub fn begin_list(&mut self, len: usize) -> usize
pub fn begin_list(&mut self, len: usize) -> usize
A list of len items packed one by one: its count, then its length
in bytes like a record’s (Packer::end writes it), so a reader
can step over it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Packer
impl RefUnwindSafe for Packer
impl Send for Packer
impl Sync for Packer
impl Unpin for Packer
impl UnsafeUnpin for Packer
impl UnwindSafe for Packer
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