Struct datamodel::DmElement

source ·
pub struct DmElement { /* private fields */ }
Expand description

The main struct for storing data in a DMX file.

Implementations§

source§

impl DmElement

source

pub fn new<S: Into<String>>(class: S, name: S) -> Self

Create a new DmElement with the given class and name.

source

pub fn empty() -> Self

Create an empty DmElement.

source

pub fn get_element<T: Element, S: AsRef<str>>(&self, name: S) -> Option<T>

Get the element with the given name and type.

source

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.

source

pub fn get_elements(&self) -> &IndexMap<UUID, DmElement>

Return a reference to all elements stored.

source

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.

source

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.

source

pub fn set_null_element<S: Into<String>>(&mut self, name: S)

Set an element attribute with the given name without any element data.

source

pub fn has_element(&self, id: UUID) -> bool

Check if the element conctains an element with the given id.

source

pub fn has_element_attribute(&self, id: UUID) -> bool

Check if the element conctains an attribute element with the given name.

source

pub fn remove_element<S: AsRef<str>>(&mut self, name: S)

Remove an element attribute with the given name.

source

pub fn get_attribute<T: Attribute>(&self, name: &str) -> Option<&T>

Return a reference to an attribute with the given name.

source

pub fn get_attributes(&self) -> &IndexMap<String, DMAttribute>

Return a reference to all attributes in the element.

source

pub fn set_attribute<T: Attribute, S: Into<String>>( &mut self, name: S, value: T )

Set an attribute with the given name and value.

source

pub fn remove_attribute<S: AsRef<str>>(&mut self, name: S)

Remove an attribute with the given name.

source

pub fn get_class(&self) -> &str

source

pub fn set_class<S: Into<String>>(&mut self, class: S)

source

pub fn get_name(&self) -> &str

source

pub fn set_name<S: Into<String>>(&mut self, name: S)

source

pub fn get_id(&self) -> &UUID

source

pub fn set_id(&mut self, id: UUID)

Trait Implementations§

source§

impl Clone for DmElement

source§

fn clone(&self) -> DmElement

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DmElement

source§

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

Formats the value using the given formatter. Read more
source§

impl Element for DmElement

source§

fn to_element(self) -> DmElement

Return an element representation of the struct.
source§

fn from_element(value: &DmElement) -> Option<Self>

Return a representation of a struct from an element.

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.