[][src]Trait gut::mesh::attrib::Attrib

pub trait Attrib where
    Self: Sized
{ fn attrib_size<I: AttribIndex<Self>>(&self) -> usize;
fn attrib_dict<I: AttribIndex<Self>>(&self) -> &AttribDict<I>;
fn attrib_dict_mut<I: AttribIndex<Self>>(&mut self) -> &mut AttribDict<I>; fn add_attrib<'a, T, I: AttribIndex<Self>>(
        &mut self,
        name: &'a str,
        def: T
    ) -> Result<&mut Attribute<I>, Error>
    where
        T: Any + Clone
, { ... }
fn add_attrib_data<'a, T, I: AttribIndex<Self>>(
        &mut self,
        name: &'a str,
        data: Vec<T>
    ) -> Result<&mut Attribute<I>, Error>
    where
        T: Any + Clone + Default
, { ... }
fn set_attrib<'a, T, I: AttribIndex<Self>>(
        &mut self,
        name: &'a str,
        def: T
    ) -> Result<&mut Attribute<I>, Error>
    where
        T: Any + Clone
, { ... }
fn set_attrib_data<'a, T, I: AttribIndex<Self>>(
        &mut self,
        name: &'a str,
        data: &[T]
    ) -> Result<&mut Attribute<I>, Error>
    where
        T: Any + Clone + Default
, { ... }
fn duplicate_attrib<'a, 'b, T, I: AttribIndex<Self>>(
        &mut self,
        name: &'a str,
        new_name: &'b str
    ) -> Result<&mut Attribute<I>, Error>
    where
        T: Any + Clone
, { ... }
fn remove_attrib<'a, I: AttribIndex<Self>>(
        &mut self,
        name: &'a str
    ) -> Result<Attribute<I>, Error> { ... }
fn insert_attrib<'a, I: AttribIndex<Self>>(
        &mut self,
        name: &'a str,
        attrib: Attribute<I>
    ) -> Result<Option<Attribute<I>>, Error> { ... }
fn attrib_or_add<'a, T, I: AttribIndex<Self>>(
        &mut self,
        name: &'a str,
        def: T
    ) -> Result<&mut Attribute<I>, Error>
    where
        T: Any + Clone
, { ... }
fn attrib_or_add_data<'a, T, I: AttribIndex<Self>>(
        &mut self,
        name: &'a str,
        data: &[T]
    ) -> Result<&mut Attribute<I>, Error>
    where
        T: Any + Clone + Default
, { ... }
fn attrib_iter<'a, 'b, T, I: 'b + AttribIndex<Self>>(
        &'b self,
        name: &'a str
    ) -> Result<Iter<T>, Error>
    where
        T: 'static + Clone
, { ... }
fn attrib_iter_mut<'a, 'b, T, I: 'b + AttribIndex<Self>>(
        &'b mut self,
        name: &'a str
    ) -> Result<IterMut<T>, Error>
    where
        T: 'static + Clone
, { ... }
fn attrib_exists<'a, I: AttribIndex<Self>>(&self, name: &'a str) -> bool { ... }
fn attrib_check<'a, T: Any, I: AttribIndex<Self>>(
        &self,
        name: &'a str
    ) -> Result<(), Error> { ... }
fn attrib_as_slice<'a, 'b, T: 'static, I: 'b + AttribIndex<Self>>(
        &'b self,
        name: &'a str
    ) -> Result<&'b [T], Error> { ... }
fn attrib_as_mut_slice<'a, 'b, T: 'static, I: 'b + AttribIndex<Self>>(
        &'b mut self,
        name: &'a str
    ) -> Result<&'b mut [T], Error> { ... }
fn attrib_clone_into_vec<'a, 'b, T, I: 'b + AttribIndex<Self>>(
        &'b self,
        name: &'a str
    ) -> Result<Vec<T>, Error>
    where
        T: 'static + Clone
, { ... }
fn attrib<'a, I: AttribIndex<Self>>(
        &self,
        name: &'a str
    ) -> Result<&Attribute<I>, Error> { ... }
fn attrib_mut<'a, I: AttribIndex<Self>>(
        &mut self,
        name: &'a str
    ) -> Result<&mut Attribute<I>, Error> { ... } }

Attribute interfaces for meshes. In order to derive this trait the mesh must have a field called attributes with type AttribDict.

Required methods

fn attrib_size<I: AttribIndex<Self>>(&self) -> usize

Get the size of the attribute at the appropriate mesh location determined by I.

fn attrib_dict<I: AttribIndex<Self>>(&self) -> &AttribDict<I>

Read only access to the attribute dictionary.

fn attrib_dict_mut<I: AttribIndex<Self>>(&mut self) -> &mut AttribDict<I>

Read and write access to the attribute dictionary.

Loading content...

Provided methods

fn add_attrib<'a, T, I: AttribIndex<Self>>(
    &mut self,
    name: &'a str,
    def: T
) -> Result<&mut Attribute<I>, Error> where
    T: Any + Clone

Add an attribute at the appropriate location with a given default.

fn add_attrib_data<'a, T, I: AttribIndex<Self>>(
    &mut self,
    name: &'a str,
    data: Vec<T>
) -> Result<&mut Attribute<I>, Error> where
    T: Any + Clone + Default

Construct an attribute from a given data Vec<T>. data must have exactly the right size for the attribute to be added successfully.

fn set_attrib<'a, T, I: AttribIndex<Self>>(
    &mut self,
    name: &'a str,
    def: T
) -> Result<&mut Attribute<I>, Error> where
    T: Any + Clone

Sets the attribute to the specified default value whether or not it already exists.

fn set_attrib_data<'a, T, I: AttribIndex<Self>>(
    &mut self,
    name: &'a str,
    data: &[T]
) -> Result<&mut Attribute<I>, Error> where
    T: Any + Clone + Default

Set an attribute to the given data slice. data must have exactly the right size for the attribute to be set successfully.

fn duplicate_attrib<'a, 'b, T, I: AttribIndex<Self>>(
    &mut self,
    name: &'a str,
    new_name: &'b str
) -> Result<&mut Attribute<I>, Error> where
    T: Any + Clone

Makes a copy of an existing attribute. Return a mutable reference to the new attribute if successful.

fn remove_attrib<'a, I: AttribIndex<Self>>(
    &mut self,
    name: &'a str
) -> Result<Attribute<I>, Error>

Remove an attribute from the attribute dictionary. From there you can use methods defined on the returned attribute, and if desired return it back to the dictionary with insert_attrib.

fn insert_attrib<'a, I: AttribIndex<Self>>(
    &mut self,
    name: &'a str,
    attrib: Attribute<I>
) -> Result<Option<Attribute<I>>, Error>

Inserts an attribute into the dictionary with the usual HashMap semantics. This means that if an attribute with the same name exists, it will be returned and the current table entry is updated with the new value. If it doesn't already exist, None is returned.

fn attrib_or_add<'a, T, I: AttribIndex<Self>>(
    &mut self,
    name: &'a str,
    def: T
) -> Result<&mut Attribute<I>, Error> where
    T: Any + Clone

Retrieve the attribute with the given name and if it doesn't exist, add a new one and set it to a given default value. In either case the mutable reference to the attribute is returned.

fn attrib_or_add_data<'a, T, I: AttribIndex<Self>>(
    &mut self,
    name: &'a str,
    data: &[T]
) -> Result<&mut Attribute<I>, Error> where
    T: Any + Clone + Default

Retrieve the attribute with the given name and if it doesn't exist, set its data to what's in the given slice. In either case the mutable reference to the attribute is returned.

fn attrib_iter<'a, 'b, T, I: 'b + AttribIndex<Self>>(
    &'b self,
    name: &'a str
) -> Result<Iter<T>, Error> where
    T: 'static + Clone

Get the attribute iterator. This is essentially a safe version of attrib(loc, name).unwrap().iter::<T>().

fn attrib_iter_mut<'a, 'b, T, I: 'b + AttribIndex<Self>>(
    &'b mut self,
    name: &'a str
) -> Result<IterMut<T>, Error> where
    T: 'static + Clone

Get the attribute mutable iterator. This is essentially a safe version of attrib_mut(name).unwrap().iter_mut::<T>().

fn attrib_exists<'a, I: AttribIndex<Self>>(&self, name: &'a str) -> bool

Return true if the given attribute exists at the given location, and false otherwise, even if the specified attribute location is invalid for the mesh.

fn attrib_check<'a, T: Any, I: AttribIndex<Self>>(
    &self,
    name: &'a str
) -> Result<(), Error>

Determine if the given attribute is valid and exists at the given location.

fn attrib_as_slice<'a, 'b, T: 'static, I: 'b + AttribIndex<Self>>(
    &'b self,
    name: &'a str
) -> Result<&'b [T], Error>

Expose the underlying attribute as a slice.

fn attrib_as_mut_slice<'a, 'b, T: 'static, I: 'b + AttribIndex<Self>>(
    &'b mut self,
    name: &'a str
) -> Result<&'b mut [T], Error>

Expose the underlying attribute as a mutable slice.

fn attrib_clone_into_vec<'a, 'b, T, I: 'b + AttribIndex<Self>>(
    &'b self,
    name: &'a str
) -> Result<Vec<T>, Error> where
    T: 'static + Clone

Clone attribute data into a Vec<T>.

fn attrib<'a, I: AttribIndex<Self>>(
    &self,
    name: &'a str
) -> Result<&Attribute<I>, Error>

Borrow the raw attribute from the attribute dictionary. From there you can use methods defined on the attribute itself.

fn attrib_mut<'a, I: AttribIndex<Self>>(
    &mut self,
    name: &'a str
) -> Result<&mut Attribute<I>, Error>

Get the raw mutable attribute from the attribute dictionary. From there you can use methods defined on the attribute itself.

Loading content...

Implementors

impl<T: Real> Attrib for PointCloud<T>[src]

impl<T: Real> Attrib for PolyMesh<T>[src]

impl<T: Real> Attrib for TetMesh<T>[src]

impl<T: Real> Attrib for TetMeshExt<T>[src]

impl<T: Real> Attrib for QuadMesh<T>[src]

impl<T: Real> Attrib for QuadMeshExt<T>[src]

impl<T: Real> Attrib for TriMesh<T>[src]

impl<T: Real> Attrib for TriMeshExt<T>[src]

Loading content...