Function varint_simd::decode_zigzag

source ·
pub fn decode_zigzag<T: SignedVarIntTarget>(
    bytes: &[u8]
) -> Result<(T, usize), VarIntDecodeError>
Expand description

Convenience function for decoding a single varint in ZigZag format from the input slice. See also: decode

Examples

use varint_simd::{decode_zigzag, VarIntDecodeError};

fn main() -> Result<(), VarIntDecodeError> {
    let decoded = decode_zigzag::<i32>(&[39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])?;
    assert_eq!(decoded, (-20, 1));
    Ok(())
}