Skip to main content

BytesWriter

Trait BytesWriter 

Source
pub trait BytesWriter {
    // Required methods
    fn put_varint(&mut self, varint: VarInt) -> Result<(), EndOfBuffer>;
    fn put_bytes(&mut self, bytes: &[u8]) -> Result<(), EndOfBuffer>;
}
Expand description

Writes bytes or varint on a source.

Required Methods§

Source

fn put_varint(&mut self, varint: VarInt) -> Result<(), EndOfBuffer>

Writes an unsigned variable-length integer in network byte-order at the current offset and advances the offset.

Returns Err if source is exhausted and no space is available.

Source

fn put_bytes(&mut self, bytes: &[u8]) -> Result<(), EndOfBuffer>

Writes (by copy) all bytes at the current offset and advances it.

Returns Err if source is exhausted and no space is available.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl BytesWriter for Vec<u8>

Source§

fn put_varint(&mut self, varint: VarInt) -> Result<(), EndOfBuffer>

Source§

fn put_bytes(&mut self, bytes: &[u8]) -> Result<(), EndOfBuffer>

Implementors§