pub fn dom_parser() -> for<'a> fn(&'a str, Option<usize>) -> Option<Dom<'a>>Expand description
Returns a CPUID-selected DOM parse function.
On CPUs with AVX-512BW the returned function uses the hand-written
assembly parser; otherwise the portable SWAR parser is used. The CPUID
check is performed once when dom_parser() is called.
The returned function has the signature
fn(&str, Option<usize>) -> Option<Dom<'_>>.
use asmjson::{dom_parser, JsonRef};
let parse = dom_parser();
let tape = parse(r#"{"x":1}"#, None).unwrap();
assert_eq!(tape.root().get("x").as_i64(), Some(1));