pub struct RawNode(pub Box<RawValue>);Expand description
An AST subtree the compiler does not model with typed nodes (type
annotations, class bodies, parser extras). Wraps JSON text: serialization
is verbatim pass-through and deserialization streams the subtree into text
without retaining a serde_json::Value tree. Consumers that inspect these
subtrees parse on demand via RawNode::parse_value; paths that do so
repeatedly per traversal pay a parse each time, so cache the parsed Value
at the call site if it shows up in profiles.
Deserialize is hand-implemented with a transcode rather than capturing a
RawValue directly: most nodes sit under #[serde(tag = "type")] enums,
whose content buffering breaks RawValue’s text-borrowing capture.
Tuple Fields§
§0: Box<RawValue>Implementations§
Source§impl RawNode
impl RawNode
pub fn from_value(value: &Value) -> Self
pub fn null() -> Self
Sourcepub fn parse_value(&self) -> Value
pub fn parse_value(&self) -> Value
Parse the subtree into a serde_json::Value for structural inspection.
RawNode text is valid JSON by construction, so failure here means a
broken invariant, not bad input; fail loudly rather than degrade.