Enum taplo::dom::node::Node

source ·
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

source

pub fn path(&self, keys: &Keys) -> Option<Node>

source

pub fn get(&self, idx: impl Index) -> Node

source

pub fn try_get(&self, idx: impl Index) -> Result<Node, Error>

source

pub fn get_matches( &self, pattern: &str ) -> Result<impl Iterator<Item = (KeyOrIndex, Node)> + ExactSizeIterator, Error>

source

pub fn validate(&self) -> Result<(), impl Iterator<Item = Error> + Debug>

Validate the node and then all children recursively.

source

pub fn flat_iter(&self) -> impl DoubleEndedIterator<Item = (Keys, Node)>

source

pub fn find_all_matches( &self, keys: Keys, include_children: bool ) -> Result<impl Iterator<Item = (Keys, Node)> + ExactSizeIterator, Error>

source

pub fn text_ranges(&self) -> impl ExactSizeIterator<Item = TextRange>

source

pub fn comments(&self) -> impl Iterator<Item = Comment>

All the comments in the tree, including header comments returned from Self::header_comments.

source

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

source

pub fn is_table(&self) -> bool

Returns true if the node is Table.

source

pub fn is_array(&self) -> bool

Returns true if the node is Array.

source

pub fn is_bool(&self) -> bool

Returns true if the node is Bool.

source

pub fn is_str(&self) -> bool

Returns true if the node is Str.

source

pub fn is_integer(&self) -> bool

Returns true if the node is Integer.

source

pub fn is_float(&self) -> bool

Returns true if the node is Float.

source

pub fn is_date(&self) -> bool

Returns true if the node is Date.

source

pub fn is_invalid(&self) -> bool

Returns true if the node is Invalid.

source

pub fn as_table(&self) -> Option<&Table>

source

pub fn as_array(&self) -> Option<&Array>

source

pub fn as_bool(&self) -> Option<&Bool>

source

pub fn as_str(&self) -> Option<&Str>

source

pub fn as_integer(&self) -> Option<&Integer>

source

pub fn as_float(&self) -> Option<&Float>

source

pub fn as_date(&self) -> Option<&DateTime>

source

pub fn as_invalid(&self) -> Option<&Invalid>

source

pub fn try_into_table(self) -> Result<Table, Self>

source

pub fn try_into_array(self) -> Result<Array, Self>

source

pub fn try_into_bool(self) -> Result<Bool, Self>

source

pub fn try_into_str(self) -> Result<Str, Self>

source

pub fn try_into_integer(self) -> Result<Integer, Self>

source

pub fn try_into_float(self) -> Result<Float, Self>

source

pub fn try_into_date(self) -> Result<DateTime, Self>

source

pub fn try_into_invalid(self) -> Result<Invalid, Self>

source§

impl Node

source

pub fn to_toml(&self, inline: bool, prefer_single_quote: bool) -> String

source

pub fn to_toml_fmt( &self, f: &mut impl Write, inline: bool, prefer_single_quote: bool ) -> Result

Trait Implementations§

source§

impl Clone for Node

source§

fn clone(&self) -> Node

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Node

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Node

source§

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 Display for Node

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DomNode for Node

source§

fn syntax(&self) -> Option<&SyntaxElement>

source§

fn errors(&self) -> &Shared<Vec<Error>>

source§

fn validate_node(&self) -> Result<(), &Shared<Vec<Error>>>

source§

fn is_valid_node(&self) -> bool

source§

impl From<Array> for Node

source§

fn from(v: Array) -> Self

Converts to this type from the input type.
source§

impl From<Bool> for Node

source§

fn from(v: Bool) -> Self

Converts to this type from the input type.
source§

impl From<DateTime> for Node

source§

fn from(v: DateTime) -> Self

Converts to this type from the input type.
source§

impl From<Float> for Node

source§

fn from(v: Float) -> Self

Converts to this type from the input type.
source§

impl From<Integer> for Node

source§

fn from(v: Integer) -> Self

Converts to this type from the input type.
source§

impl From<Invalid> for Node

source§

fn from(v: Invalid) -> Self

Converts to this type from the input type.
source§

impl From<Str> for Node

source§

fn from(v: Str) -> Self

Converts to this type from the input type.
source§

impl From<Table> for Node

source§

fn from(v: Table) -> Self

Converts to this type from the input type.
source§

impl FromSyntax for Node

source§

impl Serialize for Node

source§

fn serialize<S>(&self, ser: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,