pub struct Writer { /* private fields */ }Expand description
Writer for encoding binary data.
Implementations§
Source§impl Writer
impl Writer
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new writer with capacity.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Returns the written bytes.
Sourcepub fn write_byte(&mut self, byte: u8)
pub fn write_byte(&mut self, byte: u8)
Writes a single byte.
Sourcepub fn write_bytes(&mut self, bytes: &[u8])
pub fn write_bytes(&mut self, bytes: &[u8])
Writes raw bytes.
Sourcepub fn write_varint(&mut self, value: u64)
pub fn write_varint(&mut self, value: u64)
Writes an unsigned varint (LEB128).
Sourcepub fn write_signed_varint(&mut self, value: i64)
pub fn write_signed_varint(&mut self, value: i64)
Writes a signed varint (zigzag encoded).
Sourcepub fn write_string(&mut self, s: &str)
pub fn write_string(&mut self, s: &str)
Writes a length-prefixed UTF-8 string.
Sourcepub fn write_bytes_prefixed(&mut self, bytes: &[u8])
pub fn write_bytes_prefixed(&mut self, bytes: &[u8])
Writes a length-prefixed byte array.
Sourcepub fn write_id_vec(&mut self, ids: &[Id])
pub fn write_id_vec(&mut self, ids: &[Id])
Writes a vector of IDs with length prefix.
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 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