Enum vtkio::model::IOBuffer[][src]

pub enum IOBuffer {
    Bit(Vec<u8>),
    U8(Vec<u8>),
    I8(Vec<i8>),
    U16(Vec<u16>),
    I16(Vec<i16>),
    U32(Vec<u32>),
    I32(Vec<i32>),
    U64(Vec<u64>),
    I64(Vec<i64>),
    F32(Vec<f32>),
    F64(Vec<f64>),
}

Numeric data buffer.

This represents any loaded data such as attributes, cell indices or point coordinates.

Variants

Bit(Vec<u8>)

Bit array is stored in 8 bit chunks.

U8(Vec<u8>)

Vector of unsigned bytes.

I8(Vec<i8>)

Vector of signed bytes.

U16(Vec<u16>)

Vector of unsigned short integers u16.

I16(Vec<i16>)

Vector of signed short integers i16.

U32(Vec<u32>)

Vector of unsigned integers u32.

I32(Vec<i32>)

Vector of signed integers i32.

U64(Vec<u64>)

Vector of unsigned long integers u64.

I64(Vec<i64>)

Vector of signed long integers i64.

F32(Vec<f32>)

Vector of single precision floats.

F64(Vec<f64>)

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]

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]

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]

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]

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]

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

Blanket Implementations

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

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

impl<T> BorrowMut<T> for T where
    T: ?Sized
[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> ToString for T where
    T: Display + ?Sized
[src]

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

type Error = Infallible

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.