Enum vtkio::model::IOBuffer [−][src]
Numeric data buffer.
This represents any loaded data such as attributes, cell indices or point coordinates.
Variants
Bit array is stored in 8 bit chunks.
Vector of unsigned bytes.
Vector of signed bytes.
Vector of unsigned short integers u16
.
Vector of signed short integers i16
.
Vector of unsigned integers u32
.
Vector of signed integers i32
.
Vector of unsigned long integers u64
.
Vector of signed long integers i64
.
Vector of single precision floats.
Vector of double precision floats.
Implementations
impl IOBuffer
[src]
pub fn new<T: ToPrimitive + 'static>(v: Vec<T>) -> Self
[src]
Constructs an IOBuffer
from a given generic Vec<T>
.
This function will deduce the type T
, and if T
is none of the supported types, will
convert it to f64
.
Panics
This function will panic if T
cannot be converted to an f64
.
impl IOBuffer
[src]
pub fn scalar_type(&self) -> ScalarType
[src]
Returns the scalar type represented by this buffer.
pub fn scalar_size(&self) -> usize
[src]
Returns the number of bytes occupied by one scalar stored in this array.
In case of a Bit
array, this returns 1.
pub fn len(&self) -> usize
[src]
Returns the length of the buffer.
pub fn num_bytes(&self) -> usize
[src]
Returns the number of bytes held by this buffer.
pub fn is_empty(&self) -> bool
[src]
Checks if the buffer is empty.
pub fn into_bytes_with_size(
self,
bo: ByteOrder,
compressor: Compressor,
compression_level: u32
) -> Vec<u8>
[src]
self,
bo: ByteOrder,
compressor: Compressor,
compression_level: u32
) -> Vec<u8>
Converts this IOBuffer
into an array of bytes with a 64-bit size prefix.
The size of the scalar type in bytes is stored as a 64-bit integer at the very beginning.
This is how VTK data arrays store data in the XML files.
pub fn into_bytes_with_size32(
self,
bo: ByteOrder,
compressor: Compressor,
compression_level: u32
) -> Vec<u8>
[src]
self,
bo: ByteOrder,
compressor: Compressor,
compression_level: u32
) -> Vec<u8>
Converts this IOBuffer
into an array of bytes with a 32-bit size prefix.
The size of the scalar type in bytes is stored as a 32-bit integer at the very beginning.
This is how VTK data arrays store data in the XML files.
pub fn from_bytes(
bytes: &[u8],
scalar_type: ScalarType,
bo: ByteOrder
) -> Result<Self, Error>
[src]
bytes: &[u8],
scalar_type: ScalarType,
bo: ByteOrder
) -> Result<Self, Error>
Constructs an IOBuffer
from a slice of bytes and a corresponding scalar type.
pub fn from_byte_vec(
bytes: Vec<u8>,
scalar_type: ScalarType,
bo: ByteOrder
) -> Result<Self, Error>
[src]
bytes: Vec<u8>,
scalar_type: ScalarType,
bo: ByteOrder
) -> Result<Self, Error>
Constructs an IOBuffer
from a Vec
of bytes and a corresponding scalar type.
pub fn u8_from_bytes(bytes: &[u8]) -> Self
[src]
Construct an IOBuffer
with u8
elements from the given slice
of bytes.
pub fn i8_from_bytes(bytes: &[u8]) -> Self
[src]
Construct an IOBuffer
with i8
elements from the given slice
of bytes.
pub fn u16_from_bytes(bytes: &[u8], bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with u16
elements from the given slice
of bytes.
pub fn i16_from_bytes(bytes: &[u8], bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with i16
elements from the given slice
of bytes.
pub fn u32_from_bytes(bytes: &[u8], bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with u32
elements from the given slice
of bytes.
pub fn i32_from_bytes(bytes: &[u8], bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with i32
elements from the given slice
of bytes.
pub fn u64_from_bytes(bytes: &[u8], bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with u64
elements from the given slice
of bytes.
pub fn i64_from_bytes(bytes: &[u8], bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with i64
elements from the given slice
of bytes.
pub fn f32_from_bytes(bytes: &[u8], bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with f32
elements from the given slice
of bytes.
pub fn f64_from_bytes(bytes: &[u8], bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with f64
elements from the given slice
of bytes.
pub fn u8_from_byte_vec(bytes: Vec<u8>) -> Self
[src]
Construct an IOBuffer
with u8
elements from the given Vec
of bytes.
pub fn i8_from_byte_vec(bytes: Vec<u8>) -> Self
[src]
Construct an IOBuffer
with i8
elements from the given Vec
of bytes.
pub fn u16_from_byte_vec(bytes: Vec<u8>, bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with u16
elements from the given Vec
of bytes.
pub fn i16_from_byte_vec(bytes: Vec<u8>, bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with i16
elements from the given Vec
of bytes.
pub fn u32_from_byte_vec(bytes: Vec<u8>, bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with u32
elements from the given Vec
of bytes.
pub fn i32_from_byte_vec(bytes: Vec<u8>, bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with i32
elements from the given Vec
of bytes.
pub fn u64_from_byte_vec(bytes: Vec<u8>, bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with u64
elements from the given Vec
of bytes.
pub fn i64_from_byte_vec(bytes: Vec<u8>, bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with i64
elements from the given Vec
of bytes.
pub fn f32_from_byte_vec(bytes: Vec<u8>, bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with f32
elements from the given Vec
of bytes.
pub fn f64_from_byte_vec(bytes: Vec<u8>, bo: ByteOrder) -> Result<Self, Error>
[src]
Construct an IOBuffer
with f64
elements from the given Vec
of bytes.
pub fn iter<T: Scalar>(&self) -> Option<Iter<'_, T>>
[src]
Returns an iterator over elements with type T
.
If T
is not one of u8
, i8
, u16
, i16
, u32
, i32
, u64
, i64
, f32
, or f64
,
then None
is returned.
pub fn into_vec<T: Scalar>(self) -> Option<Vec<T>>
[src]
Converts this buffer into the underlying Vec
representation.
If T
is not one of u8
, i8
, u16
, i16
, u32
, i32
, u64
, i64
, f32
, or f64
,
then None
is returned.
pub fn cast_into<T: Scalar>(self) -> Option<Vec<T>>
[src]
Cast a vector of numbers into a given number type T
.
In case of overflow, None
is returned.
Trait Implementations
impl Clone for IOBuffer
[src]
impl Debug for IOBuffer
[src]
impl Default for IOBuffer
[src]
impl Display for IOBuffer
[src]
impl From<IOBuffer> for DataArray
[src]
impl<T: ToPrimitive + 'static> From<Vec<T, Global>> for IOBuffer
[src]
impl<T: ToPrimitive + 'static> FromIterator<T> for IOBuffer
[src]
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
impl<T: 'static> Into<Option<Vec<T, Global>>> for IOBuffer
[src]
impl PartialEq<IOBuffer> for IOBuffer
[src]
impl StructuralPartialEq for IOBuffer
[src]
Auto Trait Implementations
impl RefUnwindSafe for IOBuffer
impl Send for IOBuffer
impl Sync for IOBuffer
impl Unpin for IOBuffer
impl UnwindSafe for IOBuffer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,