[][src]Struct gut::mesh::attrib::Attribute

pub struct Attribute<I> { /* fields omitted */ }

Mesh attribute type. This stores values that can be attached to mesh elements.

Methods

impl<I> Attribute<I>[src]

This type wraps a DataBuffer to store attribute data. Having the type parameter I allows the compiler verify that attributes are being indexed correctly.

pub fn with_size<T: Any + Clone>(n: usize, def: T) -> Self[src]

Construct an attribute with a given size.

pub fn from_vec<T: Any + Clone + Default>(vec: Vec<T>) -> Self[src]

Construct an attribute from a given Vec<T> of data reusing the space aready allocated by the Vec.

pub fn from_data_buffer(data: DataBuffer, def: &[u8]) -> Self[src]

Construct an attribute from a given DataBuffer of data reusing the space aready allocated.

pub fn from_slice<T: Any + Clone + Default>(data: &[T]) -> Self[src]

Construct an attribute from a given slice of data, by copying the data.

pub fn check<T: Any>(&self) -> Result<&Self, Error>[src]

Get the type data stored within this attribute

pub fn check_mut<T: Any>(&mut self) -> Result<&mut Self, Error>[src]

Get the mutable typed data stored within this attribute

pub fn element_type_id(&self) -> TypeId[src]

Get the type data stored within this attribute

pub fn as_slice<T: Any>(&self) -> Result<&[T], Error>[src]

Produce a slice to the underlying data.

pub fn as_mut_slice<T: Any>(&mut self) -> Result<&mut [T], Error>[src]

Produce a mutable slice to the underlying data.

pub fn clone_into_vec<T: Any + Clone>(&self) -> Result<Vec<T>, Error>[src]

Convert the data stored by this attribute into a vector of the same size.

pub fn copy_into_vec<T: Any + Copy>(&self) -> Result<Vec<T>, Error>[src]

Convert the data stored by this attribute into a vector of the same size. This function is similar to clone_into_vec but assumes that elements are Copy. It may also be more performant than clone_into_vec.

pub fn iter<'a, T: Any + 'a>(&'a self) -> Result<Iter<T>, Error>[src]

Produce an iterator over the underlying data elements.

pub fn iter_mut<'a, T: Any + 'a>(&'a mut self) -> Result<IterMut<T>, Error>[src]

Produce a mutable iterator over the underlying data elements.

pub fn len(&self) -> usize[src]

Number of elements stored by this attribute. This is the same as the number of elements in the associated topology.

pub fn is_empty(&self) -> bool[src]

Check if there are any values in this attribute.

pub unsafe fn get_unchecked<T: Any + Copy>(&self, i: usize) -> T[src]

Get i'th attribute value.

pub unsafe fn get_unchecked_ref<T: Any>(&self, i: usize) -> &T[src]

Get a const reference to the i'th attribute value.

pub unsafe fn get_unchecked_mut<T: Any>(&mut self, i: usize) -> &mut T[src]

Get a mutable reference to the i'th attribute value.

pub fn buffer_ref(&self) -> &DataBuffer[src]

Get a reference to the internal DataBuffer.

pub fn buffer_mut(&mut self) -> &mut DataBuffer[src]

Get a mutable reference to the internal DataBuffer.

pub fn into_buffer(self) -> DataBuffer[src]

Convert this attribute into the underlying buffer. This consumes the attribute.

pub fn extend_by(&mut self, n: usize)[src]

Extend this attribute by n elements. Effectively, this function appends the default element n number of times to this attribute.

pub fn rotate_left(&mut self, mid: usize)[src]

Rotate this attribute in-place such that the first mid elements of the underlying buffer move to the end while the last self.len() - mid elements move to the front. After calling rotate_left, the element previously at index mid will become the first element in the slice.

pub fn rotate_right(&mut self, k: usize)[src]

Rotate this attribute in-place such that the first self.len() - k elements of the underlying buffer move to the end while the last k elements move to the front. After calling rotate_right, the element previously at index self.len() - k will become the first element in the slice.

pub fn default_bytes(&self) -> &[u8][src]

Get a reference to the defult element as a byte slice.

impl Attribute<MeshIndex>[src]

pub fn get<T: Any + Copy, I: Into<MeshIndex>>(&self, i: I) -> Result<T, Error>[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<MeshIndex>>(&self, i: I) -> Result<&T, Error>[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<MeshIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<VertexIndex>[src]

pub fn get<T: Any + Copy, I: Into<VertexIndex>>(&self, i: I) -> Result<T, Error>[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<VertexIndex>>(&self, i: I) -> Result<&T, Error>[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<VertexIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<EdgeIndex>[src]

pub fn get<T: Any + Copy, I: Into<EdgeIndex>>(&self, i: I) -> Result<T, Error>[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<EdgeIndex>>(&self, i: I) -> Result<&T, Error>[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<EdgeIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<FaceIndex>[src]

pub fn get<T: Any + Copy, I: Into<FaceIndex>>(&self, i: I) -> Result<T, Error>[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<FaceIndex>>(&self, i: I) -> Result<&T, Error>[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<FaceIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<CellIndex>[src]

pub fn get<T: Any + Copy, I: Into<CellIndex>>(&self, i: I) -> Result<T, Error>[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<CellIndex>>(&self, i: I) -> Result<&T, Error>[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<CellIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<EdgeVertexIndex>[src]

pub fn get<T: Any + Copy, I: Into<EdgeVertexIndex>>(
    &self,
    i: I
) -> Result<T, Error>
[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<EdgeVertexIndex>>(
    &self,
    i: I
) -> Result<&T, Error>
[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<EdgeVertexIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<FaceVertexIndex>[src]

pub fn get<T: Any + Copy, I: Into<FaceVertexIndex>>(
    &self,
    i: I
) -> Result<T, Error>
[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<FaceVertexIndex>>(
    &self,
    i: I
) -> Result<&T, Error>
[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<FaceVertexIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<FaceEdgeIndex>[src]

pub fn get<T: Any + Copy, I: Into<FaceEdgeIndex>>(
    &self,
    i: I
) -> Result<T, Error>
[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<FaceEdgeIndex>>(&self, i: I) -> Result<&T, Error>[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<FaceEdgeIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<CellVertexIndex>[src]

pub fn get<T: Any + Copy, I: Into<CellVertexIndex>>(
    &self,
    i: I
) -> Result<T, Error>
[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<CellVertexIndex>>(
    &self,
    i: I
) -> Result<&T, Error>
[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<CellVertexIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<CellEdgeIndex>[src]

pub fn get<T: Any + Copy, I: Into<CellEdgeIndex>>(
    &self,
    i: I
) -> Result<T, Error>
[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<CellEdgeIndex>>(&self, i: I) -> Result<&T, Error>[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<CellEdgeIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<CellFaceIndex>[src]

pub fn get<T: Any + Copy, I: Into<CellFaceIndex>>(
    &self,
    i: I
) -> Result<T, Error>
[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<CellFaceIndex>>(&self, i: I) -> Result<&T, Error>[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<CellFaceIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<VertexEdgeIndex>[src]

pub fn get<T: Any + Copy, I: Into<VertexEdgeIndex>>(
    &self,
    i: I
) -> Result<T, Error>
[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<VertexEdgeIndex>>(
    &self,
    i: I
) -> Result<&T, Error>
[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<VertexEdgeIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<VertexFaceIndex>[src]

pub fn get<T: Any + Copy, I: Into<VertexFaceIndex>>(
    &self,
    i: I
) -> Result<T, Error>
[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<VertexFaceIndex>>(
    &self,
    i: I
) -> Result<&T, Error>
[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<VertexFaceIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<VertexCellIndex>[src]

pub fn get<T: Any + Copy, I: Into<VertexCellIndex>>(
    &self,
    i: I
) -> Result<T, Error>
[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<VertexCellIndex>>(
    &self,
    i: I
) -> Result<&T, Error>
[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<VertexCellIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<EdgeFaceIndex>[src]

pub fn get<T: Any + Copy, I: Into<EdgeFaceIndex>>(
    &self,
    i: I
) -> Result<T, Error>
[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<EdgeFaceIndex>>(&self, i: I) -> Result<&T, Error>[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<EdgeFaceIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<EdgeCellIndex>[src]

pub fn get<T: Any + Copy, I: Into<EdgeCellIndex>>(
    &self,
    i: I
) -> Result<T, Error>
[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<EdgeCellIndex>>(&self, i: I) -> Result<&T, Error>[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<EdgeCellIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

impl Attribute<FaceCellIndex>[src]

pub fn get<T: Any + Copy, I: Into<FaceCellIndex>>(
    &self,
    i: I
) -> Result<T, Error>
[src]

Get i'th attribute value.

pub fn get_ref<T: Any, I: Into<FaceCellIndex>>(&self, i: I) -> Result<&T, Error>[src]

Get a const reference to the i'th attribute value.

pub fn get_mut<T: Any, I: Into<FaceCellIndex>>(
    &mut self,
    i: I
) -> Result<&mut T, Error>
[src]

Get a mutable reference to the i'th attribute value.

Trait Implementations

impl<I: Clone> Clone for Attribute<I>[src]

impl<I: PartialEq> PartialEq<Attribute<I>> for Attribute<I>[src]

impl<I: Debug> Debug for Attribute<I>[src]

impl<I> StructuralPartialEq for Attribute<I>[src]

Auto Trait Implementations

impl<I> Send for Attribute<I> where
    I: Send

impl<I> Sync for Attribute<I> where
    I: Sync

impl<I> Unpin for Attribute<I> where
    I: Unpin

impl<I> UnwindSafe for Attribute<I> where
    I: UnwindSafe

impl<I> RefUnwindSafe for Attribute<I> where
    I: RefUnwindSafe

Blanket Implementations

impl<T> Bytes for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]