Trait VarintDecode

Source
pub trait VarintDecode: Sized {
    // Required method
    fn varint_decode(data: &[u8]) -> Result<(usize, Self)>;
}
Expand description

A trait for objects than can be decoded from a varint.

pw_varint provides implementations for i16, u16, i32, u32, i64, and u64.

Required Methods§

Source

fn varint_decode(data: &[u8]) -> Result<(usize, Self)>

Decode a type from a varint encoded series of bytes.

Signed values will be implicitly zig-zag decoded.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl VarintDecode for i8

Source§

fn varint_decode(data: &[u8]) -> Result<(usize, Self)>

Source§

impl VarintDecode for i16

Source§

fn varint_decode(data: &[u8]) -> Result<(usize, Self)>

Source§

impl VarintDecode for i32

Source§

fn varint_decode(data: &[u8]) -> Result<(usize, Self)>

Source§

impl VarintDecode for i64

Source§

fn varint_decode(data: &[u8]) -> Result<(usize, Self)>

Source§

impl VarintDecode for u8

Source§

fn varint_decode(data: &[u8]) -> Result<(usize, Self)>

Source§

impl VarintDecode for u16

Source§

fn varint_decode(data: &[u8]) -> Result<(usize, Self)>

Source§

impl VarintDecode for u32

Source§

fn varint_decode(data: &[u8]) -> Result<(usize, Self)>

Source§

impl VarintDecode for u64

Source§

fn varint_decode(data: &[u8]) -> Result<(usize, Self)>

Implementors§