pub fn parse(src: &str) -> Result<Value, JsonicError>Expand description
Parse a jsonic source string with the shared default parser.
The engine is built once, on first use, and reused after that, as the
other two runtimes do (sync.Once in go/jsonic.go, the root
instance in ts/src/jsonic.ts). Reuse is safe: Tabnas::parse
takes &self and builds a fresh parse context per call, and Tabnas
is Send + Sync, so concurrent callers share one installed grammar
instead of each rebuilding it, which is what dominates a small parse.
Use make or make_with instead when the parser needs
configuring: that returns a fresh instance and leaves this one alone.
let value = tabnas_jsonic::parse("a:1, b:2")?;
assert_eq!(value.to_string(), r#"{"a":1,"b":2}"#);
assert_eq!(tabnas_jsonic::parse("]").unwrap_err().code, "unexpected");