Trait ZigZag

Source
pub trait ZigZag {
    type UInt;

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

Trait for ZigZag encoding, used to convert signed integers to unsigned integers

Required Associated Types§

Source

type UInt

The corresponding unsigned type

Required Methods§

Source

fn zigzag_encode(value: Self) -> Self::UInt

Encode a signed integer to an unsigned integer

Source

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

Decode an unsigned integer back to a signed integer

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 UInt = u8

Source§

fn zigzag_encode(value: Self) -> Self::UInt

Source§

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

Source§

impl ZigZag for i16

Source§

type UInt = u16

Source§

fn zigzag_encode(value: Self) -> Self::UInt

Source§

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

Source§

impl ZigZag for i32

Source§

type UInt = u32

Source§

fn zigzag_encode(value: Self) -> Self::UInt

Source§

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

Source§

impl ZigZag for i64

Source§

type UInt = u64

Source§

fn zigzag_encode(value: Self) -> Self::UInt

Source§

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

Source§

impl ZigZag for i128

Source§

type UInt = u128

Source§

fn zigzag_encode(value: Self) -> Self::UInt

Source§

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

Implementors§