Enum gut::mesh::attrib::AttributeData[][src]

pub enum AttributeData {
    Direct(DirectData),
    Indirect(IndirectData),
}
Expand description

Mesh attribute data.

An attribute could store attribute values directly with the corresponding mesh elements, or indirectly in a secondary storage indexed at each mesh element.

Variants

Direct(DirectData)

A direct attribute stores values located directly (and uniquely) for each mesh element.

Tuple Fields of Direct

0: DirectData
Indirect(IndirectData)

An indirect attribute stores values located on the heap an referenced using smart pointers (so non-uniquely) for each mesh element.

Additionally these values are cached in an external cache data structure to make clones cheaper and reduce memory usage.

Tuple Fields of Indirect

0: IndirectData

Implementations

Returns true if the underlying attribute is a direct attribute and false otherwise.

Returns true if the underlying attribute is an indirect attribute and false otherwise.

Construct a direct attribute with a given size.

Construct an indirect attribute with a given size.

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

Construct an indirect attribute from a given Vec<T> of data, while saving any repeated values in the given cache.

Construct an indirect attribute from a given IndirectData instance. It is assumed that the included data is already cached correctly in the associated cache.

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

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

A utility function to map over the direct and indirect attribute variants given the two closures.

A utility function to mutably map over the direct and indirect attribute variants given the two closures.

Produce a slice to the underlying direct attribute data.

Produce a mutable slice to the underlying direct attribute data.

Construct a new empty attribute with the same buffer type, default element and topology as self.

Construct a new attribute with the same buffer type, default element and topology type as 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.

Get the type data stored within this attribute

Get the mutable typed data stored within this attribute

Produce an iterator over the underlying data elements regardless of kind.

This incurs an additional Box deref when iterating.

Produce an iterator over the underlying data elements for a direct attribute.

Produce an iterator over the underlying data elements for an indirect attribute.

Produce a mutable iterator over the underlying data elements for a direct attribute.

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.

Get the type data stored within this attribute

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

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

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

Check if there are any values in this attribute.

Get a reference to the internal data as a DataSlice.

Get a mutable reference to the internal data as a DataSliceMut.

Get a reference to the internal indirect data as an HDataVec.

Get a mutable reference to the internal indirect data as an HDataVec.

Get a reference to the internal direct data as a DirectData struct.

Get a mutable reference to the internal direct data as a DirectData struct.

Convert this attribute into the underlying vector.

This consumes the attribute.

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

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.

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.

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Get a slice of bytes representing Self.

Panics if the size of the given bytes slice is not equal to the size of Self.

Convert 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. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Performs the conversion.

Return a value at the given index. This is provided as the checked version of get that will panic if the equivalent get call is None, which typically means that the given index is out of bounds. Read more

Return a value at the given index. This is provided as the unchecked version of get that has undefined behavior when the index is out of bounds. Read more

Performs the conversion.

Return a value at the given index. This is provided as the checked version of try_isolate that will panic if the equivalent try_isolate call is None, which typically means that the given index is out of bounds. Read more

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

This method tells this type how it can be pushed to a Vec as an array.

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.