pub enum Json {
Null,
Bool(bool),
Number(Decimal),
String(String),
Array(Vec<Json>),
Object(Vec<(String, Json)>),
}Expand description
A JSON value.
An object keeps its members in the order they were read or built; the canonical writer sorts them. A tree built here never holds two members with one key.
Variants§
Null
null.
Bool(bool)
true or false.
Number(Decimal)
A number, exactly.
String(String)
A string.
Array(Vec<Json>)
An array.
Object(Vec<(String, Json)>)
An object.
Implementations§
Trait Implementations§
impl Eq for Json
Source§impl Nested for Json
A value nests as deeply as the type its schema is written for, so it is
a Nested tree, which drops on a native stack of bounded size.
impl Nested for Json
A value nests as deeply as the type its schema is written for, so it is
a Nested tree, which drops on a native stack of bounded size.
Source§fn parts(&self) -> impl DoubleEndedIterator<Item = &Json>
fn parts(&self) -> impl DoubleEndedIterator<Item = &Json>
An array’s items, or an object’s members’ values.
Source§const LEAF: Json = Json::Null
const LEAF: Json = Json::Null
A node with no parts, left in a part’s place when it is moved out.
Source§fn parts_mut(&mut self) -> impl Iterator<Item = &mut Json>
fn parts_mut(&mut self) -> impl Iterator<Item = &mut Json>
The parts only
self holds, in Nested::parts order, for moving
out: none of those it shares with another tree.Source§fn same_tree(
&self,
other: &Self,
same_node: impl FnMut(&Self, &Self) -> bool,
) -> bool
fn same_tree( &self, other: &Self, same_node: impl FnMut(&Self, &Self) -> bool, ) -> bool
Whether
self and other are alike node by node, by same_node,
which says whether two nodes are alike on their own, with as many
parts: with each node’s count of parts, pre-order spells the tree.Source§fn free_parts(&mut self)
fn free_parts(&mut self)
Frees each part only
self holds that has parts of its own, leaving
Nested::LEAF in its place: what dropping self does first, so a
tree nested however deep drops on a native stack of fixed size.impl StructuralPartialEq for Json
Auto Trait Implementations§
impl Forget for Json
impl Freeze for Jsonwhere
*const u8 is !null: Freeze,
PhantomData<u64>: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Json>: Freeze,
PhantomData<(String, Json)>: Freeze,
impl Move for Json
impl RefUnwindSafe for Json
impl Send for Jsonwhere
RawVecInner: Send,
impl Sync for Jsonwhere
RawVecInner: Sync,
impl Unpin for Json
impl UnsafeUnpin for Jsonwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u64>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Json>: UnsafeUnpin,
PhantomData<(String, Json)>: UnsafeUnpin,
impl UnwindSafe for Jsonwhere
RawVecInner: UnwindSafe,
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