Struct mzdata::spectrum::bindata::DataArray

source ·
pub struct DataArray {
    pub data: Bytes,
    pub dtype: BinaryDataArrayType,
    pub compression: BinaryCompressionType,
    pub name: ArrayType,
    pub params: Option<Box<ParamList>>,
    pub unit: Unit,
}
Expand description

Represents a data array

Fields§

§data: Bytes§dtype: BinaryDataArrayType§compression: BinaryCompressionType§name: ArrayType§params: Option<Box<ParamList>>§unit: Unit

Implementations§

source§

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

A type to represent a base64-encoded, possibly compressed data array of a fixed size, usually numeric, type. It can be decoded, and it can

source

pub fn new() -> DataArray

source

pub fn from_name(name: &ArrayType) -> DataArray

source

pub fn from_name_and_type( name: &ArrayType, dtype: BinaryDataArrayType ) -> DataArray

source

pub fn from_name_type_size( name: &ArrayType, dtype: BinaryDataArrayType, size: usize ) -> DataArray

source

pub fn slice( &self, start: usize, end: usize ) -> Result<DataArray, ArrayRetrievalError>

source

pub fn slice_buffer( &self, start: usize, end: usize ) -> Result<Cow<'_, [u8]>, ArrayRetrievalError>

source

pub fn wrap( name: &ArrayType, dtype: BinaryDataArrayType, data: Bytes ) -> DataArray

source

pub fn update_buffer<T: Pod>( &mut self, data_buffer: &[T] ) -> Result<usize, ArrayRetrievalError>

source

pub fn push<T: Pod>(&mut self, value: T) -> Result<(), ArrayRetrievalError>

source

pub fn extend<T: Pod>( &mut self, values: &[T] ) -> Result<(), ArrayRetrievalError>

source

pub fn encode_bytestring(&self, compression: BinaryCompressionType) -> Bytes

source

pub fn compress_zlib(bytestring: &[u8]) -> Bytes

source

pub fn decompres_zlib(bytestring: &[u8]) -> Bytes

source

pub fn decode_and_store( &mut self ) -> Result<BinaryCompressionType, ArrayRetrievalError>

Decode the compressed data, if needed, and store that buffer in self.data. After decoding self.compression will always be BinaryCompressionType::Decoded.

The return value is the content of self.compression after decoding.

This may fail if the decoding fails for any reason.

source

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

source

pub fn decode_mut( &'transient mut self ) -> Result<&'transient mut Bytes, ArrayRetrievalError>

source

pub fn clear(&mut self)

source

pub fn store_compressed( &mut self, compression: BinaryCompressionType ) -> Result<(), ArrayRetrievalError>

The reverse of DataArray::decode_and_store, this method compresses self.data to the desired compression method and stores that buffer as self.data.

source

pub fn store_as( &mut self, dtype: BinaryDataArrayType ) -> Result<usize, ArrayRetrievalError>

source

pub const fn is_ion_mobility(&self) -> bool

Trait Implementations§

source§

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

source§

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

source§

fn dtype(&self) -> BinaryDataArrayType

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>

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>

source§

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

source§

fn view_mut( &'transient mut self ) -> Result<&'transient mut Bytes, ArrayRetrievalError>

source§

fn coerce_from_mut<T: Clone + Sized>( buffer: &mut [u8] ) -> Result<&'transient mut [T], ArrayRetrievalError>

source§

fn coerce_mut<T: Clone + Sized>( &'lifespan mut self ) -> Result<&'transient mut [T], ArrayRetrievalError>

source§

impl Clone for DataArray

source§

fn clone(&self) -> DataArray

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DataArray

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for DataArray

source§

fn default() -> DataArray

Returns the “default value” for a type. Read more
source§

impl ParamDescribed for DataArray

source§

fn params(&self) -> &[Param]

Obtain an immutable slice over the encapsulated Param list
source§

fn params_mut(&mut self) -> &mut ParamList

Obtain an mutable slice over the encapsulated Param list
source§

fn add_param(&mut self, param: Param)

Add a new Param to the entity
source§

fn remove_param(&mut self, index: usize) -> Param

Remove the ith Param from the entity.
source§

fn get_param_by_name(&self, name: &str) -> Option<&Param>

Find the first Param whose name matches name
source§

fn get_param_by_curie(&self, curie: &CURIE) -> Option<&Param>

Find the first Param whose CURIE matches curie
source§

fn get_param_by_accession(&self, accession: &str) -> Option<&Param>

Find the first Param whose Param::accession matches accession Read more
source§

fn iter_params(&self) -> Iter<'_, Param>

Iterate over the encapsulated parameter list
source§

fn iter_params_mut(&mut self) -> IterMut<'_, Param>

Iterate mutably over the encapsulated parameter list

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.