mzdata::spectrum::bindata

Trait ByteArrayView

source
pub trait ByteArrayView<'transient, 'lifespan: 'transient> {
Show 18 methods // Required methods fn view( &'lifespan self, ) -> Result<Cow<'lifespan, [u8]>, ArrayRetrievalError>; fn name(&self) -> &ArrayType; fn dtype(&self) -> BinaryDataArrayType; fn unit(&self) -> Unit; // Provided methods fn coerce_from<T: Pod>( buffer: Cow<'transient, [u8]>, ) -> Result<Cow<'transient, [T]>, ArrayRetrievalError> { ... } fn coerce<T: Pod>( &'lifespan self, ) -> Result<Cow<'transient, [T]>, ArrayRetrievalError> { ... } fn convert<S: Num + Clone + AsPrimitive<D> + Pod, D: Num + Clone + Copy + 'static>( &'lifespan self, ) -> Result<Cow<'transient, [D]>, ArrayRetrievalError> { ... } fn to_f32( &'lifespan self, ) -> Result<Cow<'transient, [f32]>, ArrayRetrievalError> { ... } fn to_f64( &'lifespan self, ) -> Result<Cow<'transient, [f64]>, ArrayRetrievalError> { ... } fn to_i32( &'lifespan self, ) -> Result<Cow<'transient, [i32]>, ArrayRetrievalError> { ... } fn to_i64( &'lifespan self, ) -> Result<Cow<'transient, [i64]>, ArrayRetrievalError> { ... } fn data_len(&'lifespan self) -> Result<usize, ArrayRetrievalError> { ... } fn iter_type<T: Pod>( &'lifespan self, ) -> Result<DataSliceIter<'lifespan, T>, ArrayRetrievalError> { ... } fn iter_u8( &'lifespan self, ) -> Result<DataSliceIter<'lifespan, u8>, ArrayRetrievalError> { ... } fn iter_f32( &'lifespan self, ) -> Result<DataSliceIter<'lifespan, f32>, ArrayRetrievalError> { ... } fn iter_f64( &'lifespan self, ) -> Result<DataSliceIter<'lifespan, f64>, ArrayRetrievalError> { ... } fn iter_i32( &'lifespan self, ) -> Result<DataSliceIter<'lifespan, i32>, ArrayRetrievalError> { ... } fn iter_i64( &'lifespan self, ) -> Result<DataSliceIter<'lifespan, i64>, ArrayRetrievalError> { ... }
}

Required Methods§

source

fn view(&'lifespan self) -> Result<Cow<'lifespan, [u8]>, ArrayRetrievalError>

source

fn name(&self) -> &ArrayType

The kind of array this is

source

fn dtype(&self) -> BinaryDataArrayType

The real data type encoded in bytes

source

fn unit(&self) -> Unit

The unit of measurement each data point is in

Provided Methods§

source

fn coerce_from<T: Pod>( buffer: Cow<'transient, [u8]>, ) -> Result<Cow<'transient, [T]>, ArrayRetrievalError>

source

fn coerce<T: Pod>( &'lifespan self, ) -> Result<Cow<'transient, [T]>, ArrayRetrievalError>

source

fn convert<S: Num + Clone + AsPrimitive<D> + Pod, D: Num + Clone + Copy + 'static>( &'lifespan self, ) -> Result<Cow<'transient, [D]>, ArrayRetrievalError>

Decode the array, then copy it to a new array, converting each element from type D to to type S

source

fn to_f32( &'lifespan self, ) -> Result<Cow<'transient, [f32]>, ArrayRetrievalError>

source

fn to_f64( &'lifespan self, ) -> Result<Cow<'transient, [f64]>, ArrayRetrievalError>

source

fn to_i32( &'lifespan self, ) -> Result<Cow<'transient, [i32]>, ArrayRetrievalError>

source

fn to_i64( &'lifespan self, ) -> Result<Cow<'transient, [i64]>, ArrayRetrievalError>

source

fn data_len(&'lifespan self) -> Result<usize, ArrayRetrievalError>

The size of encoded array in terms of # of elements of the BinaryDataArrayType given by ByteArrayView::dtype

source

fn iter_type<T: Pod>( &'lifespan self, ) -> Result<DataSliceIter<'lifespan, T>, ArrayRetrievalError>

source

fn iter_u8( &'lifespan self, ) -> Result<DataSliceIter<'lifespan, u8>, ArrayRetrievalError>

source

fn iter_f32( &'lifespan self, ) -> Result<DataSliceIter<'lifespan, f32>, ArrayRetrievalError>

source

fn iter_f64( &'lifespan self, ) -> Result<DataSliceIter<'lifespan, f64>, ArrayRetrievalError>

source

fn iter_i32( &'lifespan self, ) -> Result<DataSliceIter<'lifespan, i32>, ArrayRetrievalError>

source

fn iter_i64( &'lifespan self, ) -> Result<DataSliceIter<'lifespan, i64>, ArrayRetrievalError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

source§

impl<'transient, 'lifespan: 'transient> ByteArrayView<'transient, 'lifespan> for DataArray

source§

impl<'transient, 'lifespan: 'transient> ByteArrayView<'transient, 'lifespan> for DataArraySlice<'lifespan>