pub struct Node {
pub value: Value,
pub span: Option<Span>,
}Expand description
One value of a document and where it was read from.
Fields§
§value: ValueThe value.
span: Option<Span>Where it was read from; None for a node built by a program or changed by a fix.
Implementations§
Source§impl Node
impl Node
Sourcepub fn map<K: Into<String>>(
entries: impl IntoIterator<Item = (K, Self)>,
) -> Self
pub fn map<K: Into<String>>( entries: impl IntoIterator<Item = (K, Self)>, ) -> Self
An object from keys and values, in order.
Sourcepub const fn kind_name(&self) -> &'static str
pub const fn kind_name(&self) -> &'static str
The JSON name of the value’s kind: null, boolean, number, string, array or
object.
Sourcepub fn get(&self, key: &str) -> Option<&Self>
pub fn get(&self, key: &str) -> Option<&Self>
The value under key in an object; of a repeated key, the last, as JSON readers keep.
Sourcepub fn entry(&self, key: &str) -> Option<&Entry>
pub fn entry(&self, key: &str) -> Option<&Entry>
The entry under key in an object (the last of a repeated key).
Sourcepub fn child_mut(&mut self, segment: &Segment) -> Option<&mut Self>
pub fn child_mut(&mut self, segment: &Segment) -> Option<&mut Self>
The child a segment names, for change.
Sourcepub fn same_document(&self, other: &Self) -> bool
pub fn same_document(&self, other: &Self) -> bool
Whether two trees hold the same document, places ignored: keys in order, repeated keys kept, numbers by their spelling.
Sourcepub fn same_value(&self, other: &Self) -> bool
pub fn same_value(&self, other: &Self) -> bool
Whether two values are equal as JSON values: numbers by value, objects by their last value per key whatever the order.
Sourcepub fn without_spans(self) -> Self
pub fn without_spans(self) -> Self
The tree with every place removed, as a program would build it.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Node
impl<'de> Deserialize<'de> for Node
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Forget for Node
impl Freeze for Nodewhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Node>: Freeze,
PhantomData<Entry>: Freeze,
impl Move for Node
impl RefUnwindSafe for Node
impl Send for Nodewhere
RawVecInner: Send,
impl Sync for Nodewhere
RawVecInner: Sync,
impl Unpin for Node
impl UnsafeUnpin for Nodewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Node>: UnsafeUnpin,
PhantomData<Entry>: UnsafeUnpin,
impl UnwindSafe for Nodewhere
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