[][src]Trait ordcode::varint::VarUInt

pub trait VarUInt: Sized {
    pub fn varu_encoded_len(&self) -> u8;
pub fn varu_decoded_len(first_byte: u8) -> u8;
pub fn varu_to_writer(&self, writer: impl WriteBytes) -> Result;
pub fn varu_from_reader(reader: impl ReadBytes) -> Result<Self>;
pub fn varu_from_slice(bytes: &[u8]) -> Result<(Self, u8)>;
pub fn varu_to_slice(&self, bytes: &mut [u8]) -> u8; }

Methods for variable length serializaiton of unsigned integers

Required methods

pub fn varu_encoded_len(&self) -> u8[src]

Get the length of an varint-encoded value in bytes

pub fn varu_decoded_len(first_byte: u8) -> u8[src]

Get the byte length of varint-encoded value from the first byte

pub fn varu_to_writer(&self, writer: impl WriteBytes) -> Result[src]

Encode as variable length integer to writer

pub fn varu_from_reader(reader: impl ReadBytes) -> Result<Self>[src]

Read variable length integer from reader

pub fn varu_from_slice(bytes: &[u8]) -> Result<(Self, u8)>[src]

Decode variable length integer from slice

pub fn varu_to_slice(&self, bytes: &mut [u8]) -> u8[src]

Encode variable length integer into slice

Slice must be of enough length, and can be calculated with varu_encoded_len(). Returns actual length of encoded varint.

Loading content...

Implementations on Foreign Types

impl VarUInt for u64[src]

impl VarUInt for u32[src]

Loading content...

Implementors

Loading content...