pub struct BytesWriter { /* private fields */ }Expand description
Simple growable buffer writer with helpers for the protocol primitives.
This mirrors the JavaScript implementation’s BytesWriter from
packages/loro-protocol/src/bytes.ts.
Implementations§
Source§impl BytesWriter
impl BytesWriter
pub fn new() -> Self
pub fn push_bytes(&mut self, bytes: &[u8])
pub fn push_byte(&mut self, byte: u8)
Sourcepub fn push_uleb128(&mut self, n: u64)
pub fn push_uleb128(&mut self, n: u64)
Encode an unsigned LEB128 integer (sufficient for lengths and indices here).
pub fn push_var_bytes(&mut self, bytes: &[u8])
pub fn push_var_string(&mut self, s: &str)
pub fn finalize(self) -> Vec<u8> ⓘ
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BytesWriter
impl RefUnwindSafe for BytesWriter
impl Send for BytesWriter
impl Sync for BytesWriter
impl Unpin for BytesWriter
impl UnwindSafe for BytesWriter
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