pub enum JsonTree {
Null,
Bool(bool),
Number(String),
String(String),
Array(Vec<JsonTree>),
Object(Vec<(String, JsonTree)>),
}Expand description
A dependency-neutral JSON tree.
This is the public interchange model for guests that need JSON data without adopting the codec’s parser implementation as part of their own API.
Variants§
Null
The JSON null value.
Bool(bool)
A JSON boolean.
Number(String)
A JSON number in its validated textual representation.
String(String)
A JSON string.
Array(Vec<JsonTree>)
A JSON array.
Object(Vec<(String, JsonTree)>)
A JSON object.
Implementations§
Source§impl JsonTree
impl JsonTree
Sourcepub fn number_from_f64(codec: CodecId, value: f64) -> Result<Self>
pub fn number_from_f64(codec: CodecId, value: f64) -> Result<Self>
Constructs a JSON number from a finite binary floating-point value.
Number validation and canonical text selection remain owned by the JSON codec, so guest policies do not need their own number serializer.
Sourcepub fn number_as_f64(&self, codec: CodecId) -> Result<f64>
pub fn number_as_f64(&self, codec: CodecId) -> Result<f64>
Reads a JSON number as a binary floating-point value.
Trait Implementations§
impl Eq for JsonTree
impl StructuralPartialEq for JsonTree
Auto Trait Implementations§
impl Freeze for JsonTree
impl RefUnwindSafe for JsonTree
impl Send for JsonTree
impl Sync for JsonTree
impl Unpin for JsonTree
impl UnsafeUnpin for JsonTree
impl UnwindSafe for JsonTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.