pub enum TypedArray {
UInt8(Vec<u8>),
UInt16(Vec<u16>),
UInt32(Vec<u32>),
UInt64(Vec<u64>),
Int8(Vec<i8>),
Int16(Vec<i16>),
Int32(Vec<i32>),
Int64(Vec<i64>),
Float32(Vec<f32>),
Float64(Vec<f64>),
}Expand description
An enum representing a typed view of the array data.
use async_tiff::{DataType, TypedArray};
let data = TypedArray::try_new(vec![10, 20, 30], Some(DataType::UInt8)).unwrap();
match &data {
TypedArray::UInt8(v) => assert_eq!(v, &[10, 20, 30]),
_ => panic!("expected UInt8"),
}
let bytes = std::f32::consts::PI.to_ne_bytes().to_vec();
let data = TypedArray::try_new(bytes, Some(DataType::Float32)).unwrap();
match &data {
TypedArray::Float32(v) => assert_eq!(v[0], std::f32::consts::PI),
_ => panic!("expected Float32"),
}Variants§
UInt8(Vec<u8>)
Unsigned 8-bit integer array.
UInt16(Vec<u16>)
Unsigned 16-bit integer array.
UInt32(Vec<u32>)
Unsigned 32-bit integer array.
UInt64(Vec<u64>)
Unsigned 64-bit integer array.
Int8(Vec<i8>)
Signed 8-bit integer array.
Int16(Vec<i16>)
Signed 16-bit integer array.
Int32(Vec<i32>)
Signed 32-bit integer array.
Int64(Vec<i64>)
Signed 64-bit integer array.
Float32(Vec<f32>)
32-bit floating point array.
Float64(Vec<f64>)
64-bit floating point array.
Implementations§
Source§impl TypedArray
impl TypedArray
Trait Implementations§
Source§impl AsRef<[u8]> for TypedArray
impl AsRef<[u8]> for TypedArray
Source§impl Clone for TypedArray
impl Clone for TypedArray
Source§fn clone(&self) -> TypedArray
fn clone(&self) -> TypedArray
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TypedArray
impl RefUnwindSafe for TypedArray
impl Send for TypedArray
impl Sync for TypedArray
impl Unpin for TypedArray
impl UnwindSafe for TypedArray
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
Mutably borrows from an owned value. Read more