simd-json 0.1.17

High performance JSON parser based on a port of simdjson
Documentation
pub struct LazyDeserializer<'de> {
    de: Deserializer<'de>,
    locations: Vec<Location>,
}

enum Location {
    Object,
    Array,
}
pub enum Type {
    String,
    Null,
    Bool,
    Number,
    Array,
    Object,
}

impl<'de> LazyDeserializer<'de> {
    pub fn from_deserializer(de: Deserializer<'de>) -> Self {
        let locations = match self.de.next_() {
            b'[' => vec![Location::Array],
            b'{' => vec![Location::Object],
            _c => Vec::new(),
        };
        Self { de, locations }
    }

    pub fn current_type(&self) -> Result<Type> {
        match self.de.c() {
            b'"' => Ok(Type::String),
            b'n' => Ok(Type::Null),
            b't' | b'f' => Ok(Type::Bool),
            b'-' | b'0'..=b'9' => Ok(Type::Number),
            b'[' => Ok(Type::Array),
            b'{' => Ok(Type::Object),
            _c => Err(self.de.error(ErrorType::UnexpectedCharacter)),
        }
    }
}