Trait zigzag::ZigZagDecode[][src]

pub trait ZigZagDecode<S> {
    fn zigzag_decode(self) -> S;
}

A trait intended to extend unsigned integer types with the ability to get their signed representation as derived by zigzag decoding.

This trait does so by implementing the zigzag_decode method.

Required methods

fn zigzag_decode(self) -> S[src]

Decodes self into its signed counterpart by using zigzag decoding.

For more information on zigzag decoding, see its section in the crate documentation.

Examples

use zigzag::ZigZagDecode;

assert_eq!(0u8.zigzag_decode(), 0i8);
assert_eq!(1u8.zigzag_decode(), -1i8);
assert_eq!(2u8.zigzag_decode(), 1i8);
Loading content...

Implementations on Foreign Types

impl ZigZagDecode<i8> for u8[src]

impl ZigZagDecode<i16> for u16[src]

impl ZigZagDecode<i32> for u32[src]

impl ZigZagDecode<i64> for u64[src]

impl ZigZagDecode<i128> for u128[src]

impl ZigZagDecode<isize> for usize[src]

Loading content...

Implementors

Loading content...