Function decode_len

Source
pub fn decode_len<T: VarIntTarget>(
    bytes: &[u8],
) -> Result<usize, VarIntDecodeError>
Expand description

Decodes only the length of a single variant from the input slice.

ยงExamples

use varint_simd::{decode_len, VarIntDecodeError};

fn main() -> Result<(), VarIntDecodeError> {
    let decoded = decode_len::<u32>(&[185, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])?;
    assert_eq!(decoded, 2);
    Ok(())
}