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.
- Elements::Standard are elements whose purpose is user-defined.
- Elements::Attribute are elements which will be associated automatically with the next valid Elements::Standard element. Attributes stack.
- Elements::Global are elements which will be hoisted to the top of the parsed document result and should impact the document globally.
- Elements::Comment is documentation put in place by a tool or person.
Typically the parser is responsible for assembling these variants. See the implemenation for ways to construct a new variant.
Variants§
Implementations§
Source§impl Elements
impl Elements
Sourcepub fn new_standard(label: String) -> Elements
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.
Sourcepub fn new_attribute(label: String) -> Elements
pub fn new_attribute(label: String) -> Elements
Constructs a new Elements::Attribute with [label] to be identified with later.
Sourcepub fn new_global(label: String) -> Elements
pub fn new_global(label: String) -> Elements
Constructs a new Elements::Global with [label] to be identified with later.
Sourcepub fn new_comment(message: String) -> Elements
pub fn new_comment(message: String) -> Elements
Constructs a new Elements::Comment with a [message].
Sourcepub fn upsert_keyval(&mut self, keyval: KeyVal)
pub fn upsert_keyval(&mut self, keyval: KeyVal)
Simplifies a call to the data structure Element by pattern matching. See Element::upsert.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Elements
impl RefUnwindSafe for Elements
impl Send for Elements
impl Sync for Elements
impl Unpin for Elements
impl UnwindSafe for Elements
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