pub enum Attribute {
DataArray(DataArrayBase<ElementType>),
Field {
name: String,
data_array: Vec<DataArrayBase<u32>>,
},
}Expand description
Data structure that stores a VTK attribute.
Variants§
DataArray(DataArrayBase<ElementType>)
A data array with any number of components.
This is the standard way to represent data in XML formats.
It is also used to represent VECTORS, NORMALS, TEXTURE_COORDINATES, LOOKUP_TABLEs,
COLOR_SCALARS and TENSORS in the legacy VTK format, each of which are identified by the
elem field in the DataArray struct.
Field
Field attribute.
Essentially an array of arrays of any size. This can be used to represent data for alternative topologies that don’t correspond to the current data set, like UV coordinate topology with seams.
This is a Legacy only attribute type.
Implementations§
Source§impl Attribute
impl Attribute
Sourcepub fn scalars_with_lookup(
name: impl Into<String>,
num_comp: u32,
lookup_table: impl Into<String>,
) -> Attribute
pub fn scalars_with_lookup( name: impl Into<String>, num_comp: u32, lookup_table: impl Into<String>, ) -> Attribute
Constructs a new scalars attribute with an associated lookup table.
Sourcepub fn scalars(name: impl Into<String>, num_comp: u32) -> Attribute
pub fn scalars(name: impl Into<String>, num_comp: u32) -> Attribute
Constructs a new scalars attribute.
Sourcepub fn color_scalars(name: impl Into<String>, num_comp: u32) -> Attribute
pub fn color_scalars(name: impl Into<String>, num_comp: u32) -> Attribute
Constructs a new color scalars attribute.
Sourcepub fn lookup_table(name: impl Into<String>) -> Attribute
pub fn lookup_table(name: impl Into<String>) -> Attribute
Constructs a new lookup table attribute.
Sourcepub fn tcoords(name: impl Into<String>, num_comp: u32) -> Attribute
pub fn tcoords(name: impl Into<String>, num_comp: u32) -> Attribute
Constructs a new texture coordinates attribute with the given dimensionality.
Sourcepub fn generic(name: impl Into<String>, num_comp: u32) -> Attribute
pub fn generic(name: impl Into<String>, num_comp: u32) -> Attribute
Constructs a new generic attribute with the given number of components.
Sourcepub fn field(name: impl Into<String>) -> Attribute
pub fn field(name: impl Into<String>) -> Attribute
Constructs a new field attribute with the given name.
Sourcepub fn with_data(self, new_data: impl Into<IOBuffer>) -> Attribute
pub fn with_data(self, new_data: impl Into<IOBuffer>) -> Attribute
Sets the data of this attribute to the given buffer.
If this attribute is a Field, then nothing is changed.
If the data was previously already set, it will be overwritten with the one given in this function.
Sourcepub fn with_field_data(
self,
arrays: impl IntoIterator<Item = DataArrayBase<u32>>,
) -> Attribute
pub fn with_field_data( self, arrays: impl IntoIterator<Item = DataArrayBase<u32>>, ) -> Attribute
Adds a vector of FieldArrays to this field attribute.
If this attribute is not a Field, then nothing is changed.
§Examples
If it is more convenient to construct all field arrays individually, one can collect them all at once as follows
use vtkio::model::{Attribute, FieldArray};
let field_arrays = vec![
FieldArray::new("A", 1),
FieldArray::new("B", 2),
FieldArray::new("C", 5),
];
let field = Attribute::field("Data").with_field_data(field_arrays);Sourcepub fn add_field_data(self, data: impl Into<DataArrayBase<u32>>) -> Attribute
pub fn add_field_data(self, data: impl Into<DataArrayBase<u32>>) -> Attribute
Adds a field array to the field attribute.
If this attribute is not a Field, then nothing is changed.
§Examples
One can collect a number of field arrays into a field attribute using with a sequence of
calls to add_field_data.
use vtkio::model::{Attribute, FieldArray};
let field = Attribute::field("Data")
.add_field_data(FieldArray::new("A", 1))
.add_field_data(FieldArray::new("B", 2))
.add_field_data(FieldArray::new("C", 5));Trait Implementations§
impl StructuralPartialEq for Attribute
Auto Trait Implementations§
impl Freeze for Attribute
impl RefUnwindSafe for Attribute
impl Send for Attribute
impl Sync for Attribute
impl Unpin for Attribute
impl UnwindSafe for Attribute
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DebugBytes for Twhere
T: Debug + 'static,
impl<T> DebugBytes for Twhere
T: Debug + 'static,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§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.Source§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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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
Source§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
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.