BytesReader

Trait BytesReader 

Source
pub trait BytesReader<'a> {
    // Required methods
    fn get_varint(&mut self) -> Option<VarInt>;
    fn get_bytes(&mut self, len: usize) -> Option<&'a [u8]>;
}
Expand description

Reads bytes or varint from a source.

Required Methods§

Source

fn get_varint(&mut self) -> Option<VarInt>

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

Returns None if not enough capacity (offset is not advanced in that case).

Source

fn get_bytes(&mut self, len: usize) -> Option<&'a [u8]>

Reads len bytes from the current offset without copying and advances the offset.

Returns None if not enough capacity (offset is not advanced in that case).

Implementations on Foreign Types§

Source§

impl<'a> BytesReader<'a> for &'a [u8]

Source§

fn get_varint(&mut self) -> Option<VarInt>

Source§

fn get_bytes(&mut self, len: usize) -> Option<&'a [u8]>

Implementors§

Source§

impl<'a> BytesReader<'a> for BufferReader<'a>