json-deserializer 0.1.0

Performant library to deserialize JSON
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::error::*;

#[inline]
pub fn parse_null(values: &mut &[u8]) -> Result<(), Error> {
    let data: [u8; 4] = values
        .get(..4)
        .ok_or(Error::OutOfSpec(OutOfSpecError::InvalidEOF))?
        .try_into()
        .unwrap();
    *values = &values[4..];
    if data != [b'n', b'u', b'l', b'l'] {
        return Err(Error::OutOfSpec(OutOfSpecError::InvalidNullToken(data)));
    };
    Ok(())
}