pub struct Writer { /* private fields */ }Expand description
Append-only byte writer.
Implementations§
Source§impl Writer
impl Writer
pub fn new() -> Self
pub fn finish(self) -> Vec<u8> ⓘ
pub fn u8(&mut self, v: u8) -> &mut Self
pub fn u16(&mut self, v: u16) -> &mut Self
pub fn u32(&mut self, v: u32) -> &mut Self
pub fn u64(&mut self, v: u64) -> &mut Self
pub fn i64(&mut self, v: i64) -> &mut Self
pub fn bool(&mut self, v: bool) -> &mut Self
Sourcepub fn bytes(&mut self, v: &[u8]) -> &mut Self
pub fn bytes(&mut self, v: &[u8]) -> &mut Self
Length-prefixed bytes. The payload is copied verbatim — no escaping, no separator scan, so any byte sequence survives.
pub fn str(&mut self, v: &str) -> &mut Self
Sourcepub fn opt_str(&mut self, v: Option<&str>) -> &mut Self
pub fn opt_str(&mut self, v: Option<&str>) -> &mut Self
None and Some("") differ by the tag byte, not by length.
pub fn opt_bytes(&mut self, v: Option<&[u8]>) -> &mut Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Writer
impl RefUnwindSafe for Writer
impl Send for Writer
impl Sync for Writer
impl Unpin for Writer
impl UnsafeUnpin for Writer
impl UnwindSafe for Writer
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