Node

Enum Node 

Source
pub enum Node {
    Mapping(Vec<(Node, Node)>),
    Sequence(Vec<Node>),
    String(String),
    Null,
    Boolean(bool),
    Integer(i64),
    FloatingPoint(String),
}
Expand description

A YAML schema is a combination of a set of tags and a mechanism for resolving non-specific tags.

The tags are specified in different schemas. The spec defined three main schemas: Failsafe, JSON, and Core. The tags are grouped in the following way:

  • Failsafe Schema:
    • Mapping
    • Sequence
    • String
  • JSON Schema:
    • Null
    • Boolean
    • Integer
    • Floating Point
§Note

The YAML specification defines nodes and tags a two separate (but related) concepts. Because Rust allows us to combine enums with structured data, this crate decides to combine both these concepts into one.

Variants§

§

Mapping(Vec<(Node, Node)>)

Represents an associative container, where each key is unique in the association and mapped to exactly one value.

See https://yaml.org/spec/1.2.2/#10111-generic-mapping

§

Sequence(Vec<Node>)

Represents a collection indexed by sequential integers starting with zero.

See https://yaml.org/spec/1.2.2/#10112-generic-sequence

§

String(String)

Represents a Unicode string, a sequence of zero or more Unicode characters.

See https://yaml.org/spec/1.2.2/#0113-generic-string

§

Null

Represents the lack of a value.

See https://yaml.org/spec/1.2.2/#10211-null

§

Boolean(bool)

Represents a true/false value.

See https://yaml.org/spec/1.2.2/#10212-boolean

§

Integer(i64)

Represents arbitrary sized finite mathematical integers.

See https://yaml.org/spec/1.2.2/#10213-integer

§

FloatingPoint(String)

Represents an approximation to real numbers.

See https://yaml.org/spec/1.2.2/#10214-floating-point

Implementations§

Source§

impl Node

Source

pub fn uri(&self) -> String

Source

pub fn kind(&self) -> Kind

Source

pub fn as_name(&self) -> Option<&String>

Trait Implementations§

Source§

impl Debug for Node

Source§

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

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

impl Default for Node

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl IntoEvents for Node

Source§

fn into_events(self) -> Vec<Event>

Turns the stream of documents into a list of ordered events. Read more

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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.