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.

Object Safety§

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§