pub trait VarintEncode: Sized {
    // Required method
    fn varint_encode(self, data: &mut [u8]) -> Result<usize>;
}
Expand description

A trait for objects than can be encoded into a varint.

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

Required Methods§

source

fn varint_encode(self, data: &mut [u8]) -> Result<usize>

Encode a type into a varint encoded series of bytes.

Signed values will be implicitly zig-zag encoded.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl VarintEncode for i8

source§

fn varint_encode(self, data: &mut [u8]) -> Result<usize>

source§

impl VarintEncode for i16

source§

fn varint_encode(self, data: &mut [u8]) -> Result<usize>

source§

impl VarintEncode for i32

source§

fn varint_encode(self, data: &mut [u8]) -> Result<usize>

source§

impl VarintEncode for i64

source§

fn varint_encode(self, data: &mut [u8]) -> Result<usize>

source§

impl VarintEncode for u8

source§

fn varint_encode(self, data: &mut [u8]) -> Result<usize>

source§

impl VarintEncode for u16

source§

fn varint_encode(self, data: &mut [u8]) -> Result<usize>

source§

impl VarintEncode for u32

source§

fn varint_encode(self, data: &mut [u8]) -> Result<usize>

source§

impl VarintEncode for u64

source§

fn varint_encode(self, data: &mut [u8]) -> Result<usize>

Implementors§