ZigZag

Trait ZigZag 

Source
pub trait ZigZag: Copy {
    type Unsigned: VarInt;

    // Required methods
    fn zigzag_encode(self) -> Self::Unsigned;
    fn zigzag_decode(value: Self::Unsigned) -> Self;
}
Expand description

Trait for ZigZag encoding

Required Associated Types§

Source

type Unsigned: VarInt

Associated unsigned type

Required Methods§

Source

fn zigzag_encode(self) -> Self::Unsigned

Encode to unsigned integer using ZigZag

Source

fn zigzag_decode(value: Self::Unsigned) -> Self

Decode from unsigned integer encoded with ZigZag

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 ZigZag for i8

Source§

type Unsigned = u8

Source§

fn zigzag_encode(self) -> Self::Unsigned

Source§

fn zigzag_decode(value: Self::Unsigned) -> Self

Source§

impl ZigZag for i16

Source§

type Unsigned = u16

Source§

fn zigzag_encode(self) -> Self::Unsigned

Source§

fn zigzag_decode(value: Self::Unsigned) -> Self

Source§

impl ZigZag for i32

Source§

type Unsigned = u32

Source§

fn zigzag_encode(self) -> Self::Unsigned

Source§

fn zigzag_decode(value: Self::Unsigned) -> Self

Source§

impl ZigZag for i64

Source§

type Unsigned = u64

Source§

fn zigzag_encode(self) -> Self::Unsigned

Source§

fn zigzag_decode(value: Self::Unsigned) -> Self

Source§

impl ZigZag for i128

Source§

type Unsigned = u128

Source§

fn zigzag_encode(self) -> Self::Unsigned

Source§

fn zigzag_decode(value: Self::Unsigned) -> Self

Implementors§