Skip to main content

Module json

Module json 

Source
Expand description

Faithful Rust port of Hermes’ JSONParser (include/hermes/Parser/JSONParser.h, lib/Parser/JSONParser.cpp): the JSON value model, the uniquing/hidden-class JSONFactory, and the recursive-descent JSONParser over JSLexer.

Re-exports§

pub use factory::JSONFactory;
pub use factory::Prop;
pub use parser::JSONParser;

Modules§

factory
JSONFactory: owns the arena, uniques strings/numbers, shares hidden classes.
parser
JSONParser: recursive-descent parser driving JSLexer.

Structs§

ArrayView
Borrowed view over an array (JSONParser.h:458 JSONArray).
JSONHiddenClass
A descriptor with a sorted list of names; objects of the same shape share one (JSONParser.h:180 JSONHiddenClass). keys are sorted by string content.
JSONSharedValue
Port of JSONSharedValue (JSONParser.h:704-726). Pairs a JSON value reference with the Rc<Bump> arena that backs it so the caller can own both without worrying about arena lifetime. C++ uses const JSONValue* + shared_ptr<const Allocator>; here the raw pointer is lifetime-erased to 'static and re-tied in get() via one encapsulated unsafe deref.
ObjectView
Borrowed view over an object (JSONParser.h:239 JSONObject). Grown in B3 with name lookups + iteration.

Enums§

JSONKind
Port of JSONKind (JSONParser.h:36).
JSONValue
The base type for all JSON values (JSONParser.h:49). &'a JSONValue<'a> IS the C++ JSONValue*: nodes live in a bumpalo arena; the variant replaces the kind tag + LLVM RTTI; arena identity gives pointer equality.

Functions§

kind_to_string
Port of JSONKindToString (JSONParser.cpp:21).