pub struct Tag {
pub namespace: Option<String>,
pub name: String,
pub values: Vec<Value>,
pub attrs: Vec<Attribute>,
pub tags: Vec<Tag>,
}
Expand description
A series of values and attributes, with a name (and namespace), and optionally a subtree of tags.
All data in SDLang is stored through these.
Fields§
§namespace: Option<String>
The namespace (if any) of the tag.
name: String
The name of the tag. ""
if none was given.
values: Vec<Value>
A list of values.
attrs: Vec<Attribute>
A list of attributes.
A list of subtags (empty vector if none exist).
Implementations§
Source§impl Tag
impl Tag
Sourcepub fn new(name: String) -> Self
pub fn new(name: String) -> Self
Creates a new tag.
Note that no allocation is performed. Everything is initialised to a default empty state.
Sourcepub fn attrs(self, attrs: Vec<Attribute>) -> Self
pub fn attrs(self, attrs: Vec<Attribute>) -> Self
Sets the attribute list from a list of Attributes.
Sets the child tags.
Sourcepub fn attr<'a, 'b>(&'a self, name: &'b str) -> Option<&'a Attribute>
pub fn attr<'a, 'b>(&'a self, name: &'b str) -> Option<&'a Attribute>
Finds the given attribute by name.
Trait Implementations§
impl StructuralPartialEq for Tag
Auto Trait Implementations§
impl Freeze for Tag
impl RefUnwindSafe for Tag
impl Send for Tag
impl Sync for Tag
impl Unpin for Tag
impl UnwindSafe for Tag
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more