Enum Elements

Source
pub enum Elements {
    Standard {
        attrs: Vec<Element>,
        element: Element,
    },
    Attribute(Element),
    Global(Element),
    Comment(Element),
}
Expand description

Elements represent the four possible element types in the YES spec.

Typically the parser is responsible for assembling these variants. See the implemenation for ways to construct a new variant.

Variants§

§

Standard

Fields

§attrs: Vec<Element>
§element: Element
§

Attribute(Element)

§

Global(Element)

§

Comment(Element)

Implementations§

Source§

impl Elements

Source

pub fn new_standard(label: String) -> Elements

Constructs a new Elements::Standard with [label] to be identified with later. The initial Elements::Standard::attrs vector is empty.

Source

pub fn new_attribute(label: String) -> Elements

Constructs a new Elements::Attribute with [label] to be identified with later.

Source

pub fn new_global(label: String) -> Elements

Constructs a new Elements::Global with [label] to be identified with later.

Source

pub fn new_comment(message: String) -> Elements

Constructs a new Elements::Comment with a [message].

Source

pub fn copy(other: &Element) -> Element

Returns a copy of the data structure Element.

Source

pub fn upsert_keyval(&mut self, keyval: KeyVal)

Simplifies a call to the data structure Element by pattern matching. See Element::upsert.

Trait Implementations§

Source§

impl Display for Elements

Source§

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

Prints the element with its associated prefix character, if any, and all keyvals, if any.

Auto Trait Implementations§

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> ToString for T
where T: Display + ?Sized,

Source§

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

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.