pub enum Node {
Table(Table),
Array(Array),
Bool(Bool),
Str(Str),
Integer(Integer),
Float(Float),
Date(DateTime),
Invalid(Invalid),
}
Variants§
Table(Table)
Array(Array)
Bool(Bool)
Str(Str)
Integer(Integer)
Float(Float)
Date(DateTime)
Invalid(Invalid)
Implementations§
Source§impl Node
impl Node
pub fn path(&self, keys: &Keys) -> Option<Node>
pub fn get(&self, idx: impl Index) -> Node
pub fn try_get(&self, idx: impl Index) -> Result<Node, Error>
pub fn get_matches( &self, pattern: &str, ) -> Result<impl Iterator<Item = (KeyOrIndex, Node)> + ExactSizeIterator, Error>
Sourcepub fn validate(&self) -> Result<(), impl Iterator<Item = Error> + Debug>
pub fn validate(&self) -> Result<(), impl Iterator<Item = Error> + Debug>
Validate the node and then all children recursively.
pub fn flat_iter(&self) -> impl DoubleEndedIterator<Item = (Keys, Node)>
pub fn find_all_matches( &self, keys: Keys, include_children: bool, ) -> Result<impl Iterator<Item = (Keys, Node)> + ExactSizeIterator, Error>
pub fn text_ranges(&self) -> impl ExactSizeIterator<Item = TextRange>
Sourcepub fn comments(&self) -> impl Iterator<Item = Comment>
pub fn comments(&self) -> impl Iterator<Item = Comment>
All the comments in the tree, including header comments returned from Self::header_comments
.
Sourcepub fn header_comments(&self) -> impl Iterator<Item = Comment>
pub fn header_comments(&self) -> impl Iterator<Item = Comment>
Comments before the first item in the file.
These are always counted from the root and the same values are returned from every node in the same tree.
Source§impl Node
impl Node
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns true
if the node is Integer
.
Sourcepub fn is_invalid(&self) -> bool
pub fn is_invalid(&self) -> bool
Returns true
if the node is Invalid
.
pub fn as_table(&self) -> Option<&Table>
pub fn as_array(&self) -> Option<&Array>
pub fn as_bool(&self) -> Option<&Bool>
pub fn as_str(&self) -> Option<&Str>
pub fn as_integer(&self) -> Option<&Integer>
pub fn as_float(&self) -> Option<&Float>
pub fn as_date(&self) -> Option<&DateTime>
pub fn as_invalid(&self) -> Option<&Invalid>
pub fn try_into_table(self) -> Result<Table, Self>
pub fn try_into_array(self) -> Result<Array, Self>
pub fn try_into_bool(self) -> Result<Bool, Self>
pub fn try_into_str(self) -> Result<Str, Self>
pub fn try_into_integer(self) -> Result<Integer, Self>
pub fn try_into_float(self) -> Result<Float, Self>
pub fn try_into_date(self) -> Result<DateTime, Self>
pub fn try_into_invalid(self) -> Result<Invalid, Self>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Node
impl<'de> Deserialize<'de> for Node
Source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FromSyntax for Node
impl FromSyntax for Node
fn from_syntax(syntax: SyntaxElement) -> Self
Auto Trait Implementations§
impl Freeze for Node
impl !RefUnwindSafe for Node
impl !Send for Node
impl !Sync for Node
impl Unpin for Node
impl !UnwindSafe for Node
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