pub struct DmElement { /* private fields */ }
Expand description
The main struct for storing data in a DMX file.
Implementations§
source§impl DmElement
impl DmElement
sourcepub fn new<S: Into<String>>(class: S, name: S) -> Self
pub fn new<S: Into<String>>(class: S, name: S) -> Self
Create a new DmElement with the given class and name.
sourcepub fn get_element<T: Element, S: AsRef<str>>(&self, name: S) -> Option<T>
pub fn get_element<T: Element, S: AsRef<str>>(&self, name: S) -> Option<T>
Get the element with the given name and type.
sourcepub fn get_element_array<T: Element, S: AsRef<str>>(
&self,
name: S
) -> Option<Vec<T>>
pub fn get_element_array<T: Element, S: AsRef<str>>( &self, name: S ) -> Option<Vec<T>>
Get the element arry with the given name and type.
sourcepub fn get_elements(&self) -> &IndexMap<UUID, DmElement>
pub fn get_elements(&self) -> &IndexMap<UUID, DmElement>
Return a reference to all elements stored.
sourcepub fn set_element<T: Element, S: Into<String>>(&mut self, name: S, value: T)
pub fn set_element<T: Element, S: Into<String>>(&mut self, name: S, value: T)
Set an element attribute with the given name and element.
sourcepub fn set_element_array<T: Element, S: Into<String>>(
&mut self,
name: S,
value: Vec<T>
)
pub fn set_element_array<T: Element, S: Into<String>>( &mut self, name: S, value: Vec<T> )
Set an element array attribute with the given name and elements.
sourcepub fn set_null_element<S: Into<String>>(&mut self, name: S)
pub fn set_null_element<S: Into<String>>(&mut self, name: S)
Set an element attribute with the given name without any element data.
sourcepub fn has_element(&self, id: UUID) -> bool
pub fn has_element(&self, id: UUID) -> bool
Check if the element conctains an element with the given id.
sourcepub fn has_element_attribute(&self, id: UUID) -> bool
pub fn has_element_attribute(&self, id: UUID) -> bool
Check if the element conctains an attribute element with the given name.
sourcepub fn remove_element<S: AsRef<str>>(&mut self, name: S)
pub fn remove_element<S: AsRef<str>>(&mut self, name: S)
Remove an element attribute with the given name.
sourcepub fn get_attribute<T: Attribute>(&self, name: &str) -> Option<&T>
pub fn get_attribute<T: Attribute>(&self, name: &str) -> Option<&T>
Return a reference to an attribute with the given name.
sourcepub fn get_attributes(&self) -> &IndexMap<String, DMAttribute>
pub fn get_attributes(&self) -> &IndexMap<String, DMAttribute>
Return a reference to all attributes in the element.
sourcepub fn set_attribute<T: Attribute, S: Into<String>>(
&mut self,
name: S,
value: T
)
pub fn set_attribute<T: Attribute, S: Into<String>>( &mut self, name: S, value: T )
Set an attribute with the given name and value.
sourcepub fn remove_attribute<S: AsRef<str>>(&mut self, name: S)
pub fn remove_attribute<S: AsRef<str>>(&mut self, name: S)
Remove an attribute with the given name.