pub trait Sax<'src> {
type Output;
// Required methods
fn null(&mut self);
fn bool_val(&mut self, v: bool);
fn number(&mut self, s: &'src str);
fn string(&mut self, s: &'src str);
fn escaped_string(&mut self, s: &str);
fn key(&mut self, s: &'src str);
fn escaped_key(&mut self, s: &str);
fn start_object(&mut self);
fn end_object(&mut self);
fn start_array(&mut self);
fn end_array(&mut self);
fn finish(self) -> Option<Self::Output>;
}Expand description
Receives a stream of structural events as the parser walks the input.
Implement this trait to produce any output from a single pass over the JSON
source. The built-in implementation used by crate::parse_to_dom
produces a flat crate::dom::Dom.
A custom implementation can be driven via crate::parse_with (portable
SWAR) or [crate::parse_with_zmm] (AVX-512BW assembly).
Required Associated Types§
Required Methods§
Sourcefn string(&mut self, s: &'src str)
fn string(&mut self, s: &'src str)
A JSON string value with no escape sequences; s borrows from the source.
Sourcefn escaped_string(&mut self, s: &str)
fn escaped_string(&mut self, s: &str)
A JSON string value that contained escape sequences.
s is the raw slice from the source JSON, still containing backslash
sequences (e.g. \n, \uXXXX). Call [crate::unescape_str] if you
need the decoded text.
Sourcefn key(&mut self, s: &'src str)
fn key(&mut self, s: &'src str)
An object key with no escape sequences; s borrows from the source.
Sourcefn escaped_key(&mut self, s: &str)
fn escaped_key(&mut self, s: &str)
An object key that contained escape sequences.
s is the raw slice from the source JSON, still containing backslash
sequences. Call [crate::unescape_str] if you need the decoded text.
Sourcefn start_object(&mut self)
fn start_object(&mut self)
Opening { of an object.
Sourcefn end_object(&mut self)
fn end_object(&mut self)
Closing } of an object.
Sourcefn start_array(&mut self)
fn start_array(&mut self)
Opening [ of an array.