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);