pub struct Context { /* private fields */ }Expand description
The context: always data, metadata and temp_data, in that order.
Each root starts as an object, and every write keeps it one: map,
Ctx::set and Context::set refuse anything else at a root.
Read from JSON, it takes the three roots in any order and writes them in
that order, reads a missing one as {}, takes any value at each (a
trace’s redacted root is null), and refuses any other key,
since expressions evaluate against the whole object and a fourth key
would be readable by {"var": …}. An object anywhere in it holding a key
twice is refused too: the engine reads the first, where a JSON parser
keeps the last, so the two would disagree on what the context says.
Implementations§
Source§impl Context
impl Context
Sourcepub fn data(&self) -> &OwnedDataValue
pub fn data(&self) -> &OwnedDataValue
The data root.
Sourcepub fn metadata(&self) -> &OwnedDataValue
pub fn metadata(&self) -> &OwnedDataValue
The metadata root.
Sourcepub fn temp_data(&self) -> &OwnedDataValue
pub fn temp_data(&self) -> &OwnedDataValue
The temp_data root.
Sourcepub fn as_value(&self) -> &OwnedDataValue
pub fn as_value(&self) -> &OwnedDataValue
The object holding the three roots: what expressions evaluate against.