pub struct Attribute<I> {
pub data: AttributeData,
/* private fields */
}
Expand description
Mesh attribute with an associated topology I
.
This stores values that can be attached to mesh elements.
Fields§
§data: AttributeData
Underlying attribute data.
This can be used to manipulate attribute values or their references directly.
Implementations§
source§impl<I> Attribute<I>
impl<I> Attribute<I>
This type wraps a DataVec
to store attribute data. Having the type parameter I
allows
the compiler verify that attributes are being indexed correctly.
sourcepub fn direct_with_size<T: AttributeValue>(n: usize, def: T) -> Self
pub fn direct_with_size<T: AttributeValue>(n: usize, def: T) -> Self
Construct a direct attribute with a given size.
sourcepub fn indirect_with_size<T: AttributeValueHash>(n: usize, def: T) -> Self
pub fn indirect_with_size<T: AttributeValueHash>(n: usize, def: T) -> Self
Construct an indirect attribute with a given size.
sourcepub fn direct_from_vec<T: AttributeValue + Default>(vec: Vec<T>) -> Self
pub fn direct_from_vec<T: AttributeValue + Default>(vec: Vec<T>) -> Self
Construct a direct attribute from a given Vec<T>
of data reusing the space already
allocated by the Vec
.
sourcepub fn indirect_from_vec<T: AttributeValueHash + Default>(
vec: Vec<T>,
cache: &mut AttribValueCache
) -> Self
pub fn indirect_from_vec<T: AttributeValueHash + Default>( vec: Vec<T>, cache: &mut AttribValueCache ) -> Self
Construct an indirect attribute from a given Vec<T>
of data, while saving any repeated
values in the given cache.
sourcepub fn indirect_from_data(data: IndirectData) -> Self
pub fn indirect_from_data(data: IndirectData) -> Self
Construct an indirect attribute from a given IndirectData
instance. It is assumed that
the included data is already cached correctly in the associated cache.
sourcepub fn as_slice<T: Any>(&self) -> Result<&[T], Error>
pub fn as_slice<T: Any>(&self) -> Result<&[T], Error>
Produce a slice to the underlying direct attribute data.
sourcepub fn as_mut_slice<T: Any>(&mut self) -> Result<&mut [T], Error>
pub fn as_mut_slice<T: Any>(&mut self) -> Result<&mut [T], Error>
Produce a mutable slice to the underlying direct attribute data.
sourcepub fn duplicate_empty(&self) -> Self
pub fn duplicate_empty(&self) -> Self
Construct a new empty attribute with the same buffer type, default element and topology as
self
.
sourcepub fn duplicate_with(
&self,
duplicate_data: impl FnOnce(&mut VecDyn<dyn HasAttributeValue>, Slice<'_, dyn HasAttributeValue>)
) -> Self
pub fn duplicate_with( &self, duplicate_data: impl FnOnce(&mut VecDyn<dyn HasAttributeValue>, Slice<'_, dyn HasAttributeValue>) ) -> Self
Construct a new attribute with the same buffer type, default element and topology type as
self
.
The data within the newly created attribute is expected to be initialized with the given
function init
, which takes the output DataSliceMut
for the new attribute and the existing
DataSlice
from self
.
sourcepub fn duplicate_with_len(
&self,
len: usize,
init: impl FnOnce(DataSliceMut<'_>, DataSlice<'_>)
) -> Self
pub fn duplicate_with_len( &self, len: usize, init: impl FnOnce(DataSliceMut<'_>, DataSlice<'_>) ) -> Self
Construct a new attribute with the same buffer type, default element and topology type as
self
.
The attribute is first initialized with the default value by allocating len
default
elements. Then the newly created buffer is expected to be modified by the init
function.
sourcepub fn promote_empty<J>(&self) -> Attribute<J>
pub fn promote_empty<J>(&self) -> Attribute<J>
Construct a new empty attribute with the same buffer type and default element as self
.
In contrast to duplicate_empty
this function allows the new attribute to correspond with a
different topology.
sourcepub fn promote<J>(&self) -> Attribute<J>
pub fn promote<J>(&self) -> Attribute<J>
Construct a new attribute with the same data and default element as
self
, but corresponding to a different topology.
sourcepub fn promote_into<J>(self) -> Attribute<J>
pub fn promote_into<J>(self) -> Attribute<J>
Construct a new attribute with the same data and default element as
self
, but corresponding to a different topology.
This function consumes the given attribute.
sourcepub fn promote_with<J>(
&self,
promote_data: impl FnOnce(&mut VecDyn<dyn HasAttributeValue>, Slice<'_, dyn HasAttributeValue>)
) -> Attribute<J>
pub fn promote_with<J>( &self, promote_data: impl FnOnce(&mut VecDyn<dyn HasAttributeValue>, Slice<'_, dyn HasAttributeValue>) ) -> Attribute<J>
Construct a new attribute with the same buffer type and default element as self
.
sourcepub fn promote_with_len<J>(
&self,
len: usize,
init: impl FnOnce(DataSliceMut<'_>, DataSlice<'_>)
) -> Attribute<J>
pub fn promote_with_len<J>( &self, len: usize, init: impl FnOnce(DataSliceMut<'_>, DataSlice<'_>) ) -> Attribute<J>
Construct a new attribute with the same buffer type and default element as self
.
The attribute is first initialized with the default value by allocating len
default
elements. Then the newly created buffer is expected to be modified by the init
function.
sourcepub fn direct_from_slice<T: AttributeValue + Default>(data: &[T]) -> Self
pub fn direct_from_slice<T: AttributeValue + Default>(data: &[T]) -> Self
Construct a direct attribute from a given slice of data, by copying the data.
sourcepub fn indirect_from_slice<T: AttributeValueHash + Default>(
data: &[T],
cache: &mut AttribValueCache
) -> Self
pub fn indirect_from_slice<T: AttributeValueHash + Default>( data: &[T], cache: &mut AttribValueCache ) -> Self
Construct an indirect attribute from a given slice of data, by copying the data.
sourcepub fn check<T: Any>(&self) -> Result<&Self, Error>
pub fn check<T: Any>(&self) -> Result<&Self, Error>
Get the type data stored within this attribute
sourcepub fn check_mut<T: Any>(&mut self) -> Result<&mut Self, Error>
pub fn check_mut<T: Any>(&mut self) -> Result<&mut Self, Error>
Get the mutable typed data stored within this attribute
sourcepub fn iter<'a, T: Any>(
&'a self
) -> Result<Box<dyn Iterator<Item = &'a T> + 'a>, Error>
pub fn iter<'a, T: Any>( &'a self ) -> Result<Box<dyn Iterator<Item = &'a T> + 'a>, Error>
Produce an iterator over the underlying data elements.
sourcepub fn direct_iter<T: Any>(&self) -> Result<Iter<'_, T>, Error>
pub fn direct_iter<T: Any>(&self) -> Result<Iter<'_, T>, Error>
Produce an iterator over the underlying data elements for a direct attribute.
sourcepub fn indirect_iter<T: Any>(&self) -> Result<impl Iterator<Item = &T>, Error>
pub fn indirect_iter<T: Any>(&self) -> Result<impl Iterator<Item = &T>, Error>
Produce an iterator over the underlying data elements for an indirect attribute.
sourcepub fn direct_iter_mut<T: Any>(&mut self) -> Result<IterMut<'_, T>, Error>
pub fn direct_iter_mut<T: Any>(&mut self) -> Result<IterMut<'_, T>, Error>
Produce a mutable iterator over the underlying data elements for a direct attribute.
sourcepub fn indirect_update_with<T, F>(
&mut self,
f: F,
cache: &mut AttribValueCache
) -> Result<&mut Self, Error>
pub fn indirect_update_with<T, F>( &mut self, f: F, cache: &mut AttribValueCache ) -> Result<&mut Self, Error>
Iterate over all the value in this attribute and update them as needed.
This function takes a closure which takes an index and a smart pointer to the stored value and produces an optional new value. The new value is then used to update the attribute using the provided cache.
sourcepub fn clone_into_vec<T: AttributeValueHash>(&self) -> Result<Vec<T>, Error>
pub fn clone_into_vec<T: AttributeValueHash>(&self) -> Result<Vec<T>, Error>
Convert the data stored by this attribute into a vector of the same size.
sourcepub fn direct_clone_into_vec<T: Any + Clone>(&self) -> Result<Vec<T>, Error>
pub fn direct_clone_into_vec<T: Any + Clone>(&self) -> Result<Vec<T>, Error>
Convert the data stored by this direct attribute into a vector of the same size.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of elements stored by this attribute. This is the same as the number of elements in the associated topology.
sourcepub fn data_slice(&self) -> DataSlice<'_>
pub fn data_slice(&self) -> DataSlice<'_>
Get a reference to the internal data as a DataSlice
.
sourcepub fn data_mut_slice(&mut self) -> DataSliceMut<'_>
pub fn data_mut_slice(&mut self) -> DataSliceMut<'_>
Get a mutable reference to the internal data as a DataSliceMut
.
sourcepub fn into_data(self) -> DataVec
pub fn into_data(self) -> DataVec
Convert this attribute into the underlying buffer. This consumes the attribute.
sourcepub fn extend_by(&mut self, n: usize)
pub fn extend_by(&mut self, n: usize)
Extend this attribute by n
elements. Effectively, this function appends the default
element n
number of times to this attribute.
sourcepub fn rotate_left(&mut self, mid: usize)
pub fn rotate_left(&mut self, mid: usize)
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.
sourcepub fn rotate_right(&mut self, k: usize)
pub fn rotate_right(&mut self, k: usize)
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.
sourcepub fn default_element(&self) -> ValueRef<'_>
pub fn default_element(&self) -> ValueRef<'_>
Get a reference to the default element.
source§impl Attribute<MeshIndex>
impl Attribute<MeshIndex>
sourcepub fn get<T: Any + Copy, I: Into<MeshIndex>>(&self, i: I) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<MeshIndex>>(&self, i: I) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<MeshIndex>>(&self, i: I) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<MeshIndex>>(&self, i: I) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<MeshIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<MeshIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<VertexIndex>
impl Attribute<VertexIndex>
sourcepub fn get<T: Any + Copy, I: Into<VertexIndex>>(&self, i: I) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<VertexIndex>>(&self, i: I) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<VertexIndex>>(&self, i: I) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<VertexIndex>>(&self, i: I) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<VertexIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<VertexIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<EdgeIndex>
impl Attribute<EdgeIndex>
sourcepub fn get<T: Any + Copy, I: Into<EdgeIndex>>(&self, i: I) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<EdgeIndex>>(&self, i: I) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<EdgeIndex>>(&self, i: I) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<EdgeIndex>>(&self, i: I) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<EdgeIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<EdgeIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<FaceIndex>
impl Attribute<FaceIndex>
sourcepub fn get<T: Any + Copy, I: Into<FaceIndex>>(&self, i: I) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<FaceIndex>>(&self, i: I) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<FaceIndex>>(&self, i: I) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<FaceIndex>>(&self, i: I) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<FaceIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<FaceIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<CellIndex>
impl Attribute<CellIndex>
sourcepub fn get<T: Any + Copy, I: Into<CellIndex>>(&self, i: I) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<CellIndex>>(&self, i: I) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<CellIndex>>(&self, i: I) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<CellIndex>>(&self, i: I) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<CellIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<CellIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<EdgeVertexIndex>
impl Attribute<EdgeVertexIndex>
sourcepub fn get<T: Any + Copy, I: Into<EdgeVertexIndex>>(
&self,
i: I
) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<EdgeVertexIndex>>( &self, i: I ) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<EdgeVertexIndex>>(
&self,
i: I
) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<EdgeVertexIndex>>( &self, i: I ) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<EdgeVertexIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<EdgeVertexIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<FaceVertexIndex>
impl Attribute<FaceVertexIndex>
sourcepub fn get<T: Any + Copy, I: Into<FaceVertexIndex>>(
&self,
i: I
) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<FaceVertexIndex>>( &self, i: I ) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<FaceVertexIndex>>(
&self,
i: I
) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<FaceVertexIndex>>( &self, i: I ) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<FaceVertexIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<FaceVertexIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<FaceEdgeIndex>
impl Attribute<FaceEdgeIndex>
sourcepub fn get<T: Any + Copy, I: Into<FaceEdgeIndex>>(
&self,
i: I
) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<FaceEdgeIndex>>( &self, i: I ) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<FaceEdgeIndex>>(&self, i: I) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<FaceEdgeIndex>>(&self, i: I) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<FaceEdgeIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<FaceEdgeIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<CellVertexIndex>
impl Attribute<CellVertexIndex>
sourcepub fn get<T: Any + Copy, I: Into<CellVertexIndex>>(
&self,
i: I
) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<CellVertexIndex>>( &self, i: I ) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<CellVertexIndex>>(
&self,
i: I
) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<CellVertexIndex>>( &self, i: I ) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<CellVertexIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<CellVertexIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<CellEdgeIndex>
impl Attribute<CellEdgeIndex>
sourcepub fn get<T: Any + Copy, I: Into<CellEdgeIndex>>(
&self,
i: I
) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<CellEdgeIndex>>( &self, i: I ) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<CellEdgeIndex>>(&self, i: I) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<CellEdgeIndex>>(&self, i: I) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<CellEdgeIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<CellEdgeIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<CellFaceIndex>
impl Attribute<CellFaceIndex>
sourcepub fn get<T: Any + Copy, I: Into<CellFaceIndex>>(
&self,
i: I
) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<CellFaceIndex>>( &self, i: I ) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<CellFaceIndex>>(&self, i: I) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<CellFaceIndex>>(&self, i: I) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<CellFaceIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<CellFaceIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<VertexEdgeIndex>
impl Attribute<VertexEdgeIndex>
sourcepub fn get<T: Any + Copy, I: Into<VertexEdgeIndex>>(
&self,
i: I
) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<VertexEdgeIndex>>( &self, i: I ) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<VertexEdgeIndex>>(
&self,
i: I
) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<VertexEdgeIndex>>( &self, i: I ) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<VertexEdgeIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<VertexEdgeIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<VertexFaceIndex>
impl Attribute<VertexFaceIndex>
sourcepub fn get<T: Any + Copy, I: Into<VertexFaceIndex>>(
&self,
i: I
) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<VertexFaceIndex>>( &self, i: I ) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<VertexFaceIndex>>(
&self,
i: I
) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<VertexFaceIndex>>( &self, i: I ) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<VertexFaceIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<VertexFaceIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<VertexCellIndex>
impl Attribute<VertexCellIndex>
sourcepub fn get<T: Any + Copy, I: Into<VertexCellIndex>>(
&self,
i: I
) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<VertexCellIndex>>( &self, i: I ) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<VertexCellIndex>>(
&self,
i: I
) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<VertexCellIndex>>( &self, i: I ) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<VertexCellIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<VertexCellIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<EdgeFaceIndex>
impl Attribute<EdgeFaceIndex>
sourcepub fn get<T: Any + Copy, I: Into<EdgeFaceIndex>>(
&self,
i: I
) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<EdgeFaceIndex>>( &self, i: I ) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<EdgeFaceIndex>>(&self, i: I) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<EdgeFaceIndex>>(&self, i: I) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<EdgeFaceIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<EdgeFaceIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<EdgeCellIndex>
impl Attribute<EdgeCellIndex>
sourcepub fn get<T: Any + Copy, I: Into<EdgeCellIndex>>(
&self,
i: I
) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<EdgeCellIndex>>( &self, i: I ) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<EdgeCellIndex>>(&self, i: I) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<EdgeCellIndex>>(&self, i: I) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<EdgeCellIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<EdgeCellIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
source§impl Attribute<FaceCellIndex>
impl Attribute<FaceCellIndex>
sourcepub fn get<T: Any + Copy, I: Into<FaceCellIndex>>(
&self,
i: I
) -> Result<T, Error>
pub fn get<T: Any + Copy, I: Into<FaceCellIndex>>( &self, i: I ) -> Result<T, Error>
Get i
’th attribute value.
sourcepub fn get_ref<T: Any, I: Into<FaceCellIndex>>(&self, i: I) -> Result<&T, Error>
pub fn get_ref<T: Any, I: Into<FaceCellIndex>>(&self, i: I) -> Result<&T, Error>
Get a const
reference to the i
’th attribute value.
sourcepub fn get_mut<T: Any, I: Into<FaceCellIndex>>(
&mut self,
i: I
) -> Result<&mut T, Error>
pub fn get_mut<T: Any, I: Into<FaceCellIndex>>( &mut self, i: I ) -> Result<&mut T, Error>
Get a mutable reference to the i
’th direct attribute value.
This function works only on direct attributes. Indirect attributes cannot be modified via mutable references, since they employ a special caching mechanism which aliases each stored element.
Trait Implementations§
source§impl<I: PartialEq> PartialEq for Attribute<I>
impl<I: PartialEq> PartialEq for Attribute<I>
impl<I> StructuralPartialEq for Attribute<I>
Auto Trait Implementations§
impl<I> RefUnwindSafe for Attribute<I>where
I: RefUnwindSafe,
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,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneBytes for Twhere
T: Clone + 'static,
impl<T> CloneBytes for Twhere
T: Clone + 'static,
unsafe fn clone_bytes(src: &[MaybeUninit<u8>]) -> Box<[MaybeUninit<u8>]>
unsafe fn clone_from_bytes(dst: &mut [MaybeUninit<u8>], src: &[MaybeUninit<u8>])
unsafe fn clone_into_raw_bytes( src: &[MaybeUninit<u8>], dst: &mut [MaybeUninit<u8>] )
source§impl<T> DebugBytes for Twhere
T: Debug + 'static,
impl<T> DebugBytes for Twhere
T: Debug + 'static,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> DropBytes for Twhere
T: 'static,
impl<T> DropBytes for Twhere
T: 'static,
unsafe fn drop_bytes(bytes: &mut [MaybeUninit<u8>])
source§impl<'a, S, I> Get<'a, I> for Swhere
I: GetIndex<'a, S>,
impl<'a, S, I> Get<'a, I> for Swhere
I: GetIndex<'a, S>,
type Output = <I as GetIndex<'a, S>>::Output
fn get(&self, idx: I) -> Option<<I as GetIndex<'a, S>>::Output>
source§fn at(&self, idx: I) -> Self::Output
fn at(&self, idx: I) -> Self::Output
get
that will panic if the equivalent get
call is None
,
which typically means that the given index is out of bounds. Read moresource§unsafe fn at_unchecked(&self, idx: I) -> Self::Output
unsafe fn at_unchecked(&self, idx: I) -> Self::Output
source§impl<S, I> Isolate<I> for Swhere
I: IsolateIndex<S>,
impl<S, I> Isolate<I> for Swhere
I: IsolateIndex<S>,
source§impl<T> PartialEqBytes for Twhere
T: PartialEq + 'static,
impl<T> PartialEqBytes for Twhere
T: PartialEq + 'static,
unsafe fn eq_bytes(a: &[MaybeUninit<u8>], b: &[MaybeUninit<u8>]) -> bool
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T, N> PushArrayToVec<N> for T
impl<T, N> PushArrayToVec<N> for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.