[−][src]Struct sdlang::Tag
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).
Methods
impl Tag
[src]
pub fn new(name: String) -> Self
[src]
Creates a new tag.
Note that no allocation is performed. Everything is initialised to a default empty state.
pub fn namespace(self, namespace: String) -> Self
[src]
Sets the namespace.
pub fn values(self, values: Vec<Value>) -> Self
[src]
Sets the value list.
pub fn attrs(self, attrs: Vec<Attribute>) -> Self
[src]
Sets the attribute list from a list of Attributes.
pub fn tags(self, tags: Vec<Tag>) -> Self
[src]
Sets the child tags.
pub fn attr<'a, 'b>(&'a self, name: &'b str) -> Option<&'a Attribute>
[src]
Finds the given attribute by name.
pub fn attr_mut<'a, 'b>(
&'a mut self,
name: &'b str
) -> Option<&'a mut Attribute>
[src]
&'a mut self,
name: &'b str
) -> Option<&'a mut Attribute>
Finds the given attribute by name, returning a mutable reference.
pub fn tag<'a, 'b>(&'a self, name: &'b str) -> Option<&'a Tag>
[src]
Finds the given subtag by name.
pub fn tag_mut<'a, 'b>(&'a mut self, name: &'b str) -> Option<&'a mut Tag>
[src]
Finds the given tag by name, returning a mutable reference.
Trait Implementations
impl PartialEq<Tag> for Tag
[src]
impl Display for Tag
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Returns a human-readable representation of the tag. The format is roughly this:
tag "<namespace>:<name>": <values>, <attributes>
* <subtag_1>
* <subtag_1_subtag>
* ...
* <subtag_2>
* ...
impl Debug for Tag
[src]
impl FromStr for Tag
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,