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
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
pub fn new() -> DataArray
pub fn from_name(name: &ArrayType) -> DataArray
pub fn from_name_and_type( name: &ArrayType, dtype: BinaryDataArrayType ) -> DataArray
pub fn from_name_type_size( name: &ArrayType, dtype: BinaryDataArrayType, size: usize ) -> DataArray
pub fn slice( &self, start: usize, end: usize ) -> Result<DataArray, ArrayRetrievalError>
pub fn slice_buffer( &self, start: usize, end: usize ) -> Result<Cow<'_, [u8]>, ArrayRetrievalError>
pub fn wrap( name: &ArrayType, dtype: BinaryDataArrayType, data: Bytes ) -> DataArray
pub fn update_buffer<T: Pod>( &mut self, data_buffer: &[T] ) -> Result<usize, ArrayRetrievalError>
pub fn push<T: Pod>(&mut self, value: T) -> Result<(), ArrayRetrievalError>
pub fn extend<T: Pod>( &mut self, values: &[T] ) -> Result<(), ArrayRetrievalError>
pub fn encode_bytestring(&self, compression: BinaryCompressionType) -> Bytes
pub fn compress_zlib(bytestring: &[u8]) -> Bytes
pub fn decompres_zlib(bytestring: &[u8]) -> Bytes
sourcepub fn decode_and_store(
&mut self
) -> Result<BinaryCompressionType, ArrayRetrievalError>
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.
pub fn decode( &'lifespan self ) -> Result<Cow<'lifespan, [u8]>, ArrayRetrievalError>
pub fn decode_mut( &'transient mut self ) -> Result<&'transient mut Bytes, ArrayRetrievalError>
pub fn clear(&mut self)
sourcepub fn store_compressed(
&mut self,
compression: BinaryCompressionType
) -> Result<(), ArrayRetrievalError>
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
.
pub fn store_as( &mut self, dtype: BinaryDataArrayType ) -> Result<usize, ArrayRetrievalError>
pub const fn is_ion_mobility(&self) -> bool
Trait Implementations§
source§impl<'transient, 'lifespan: 'transient> ByteArrayView<'transient, 'lifespan> for DataArray
impl<'transient, 'lifespan: 'transient> ByteArrayView<'transient, 'lifespan> for DataArray
fn view(&'lifespan self) -> Result<Cow<'lifespan, [u8]>, ArrayRetrievalError>
fn dtype(&self) -> BinaryDataArrayType
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>
source§impl<'transient, 'lifespan: 'transient> ByteArrayViewMut<'transient, 'lifespan> for DataArray
impl<'transient, 'lifespan: 'transient> ByteArrayViewMut<'transient, 'lifespan> for DataArray
fn view_mut( &'transient mut self ) -> Result<&'transient mut Bytes, ArrayRetrievalError>
fn coerce_from_mut<T: Clone + Sized>( buffer: &mut [u8] ) -> Result<&'transient mut [T], ArrayRetrievalError>
fn coerce_mut<T: Clone + Sized>( &'lifespan mut self ) -> Result<&'transient mut [T], ArrayRetrievalError>
source§impl ParamDescribed for DataArray
impl ParamDescribed for DataArray
source§fn params_mut(&mut self) -> &mut ParamList
fn params_mut(&mut self) -> &mut ParamList
Obtain an mutable slice over the encapsulated
Param
listsource§fn get_param_by_name(&self, name: &str) -> Option<&Param>
fn get_param_by_name(&self, name: &str) -> Option<&Param>
Find the first
Param
whose name matches name
source§fn iter_params(&self) -> Iter<'_, Param>
fn iter_params(&self) -> Iter<'_, Param>
Iterate over the encapsulated parameter list
source§fn iter_params_mut(&mut self) -> IterMut<'_, Param>
fn iter_params_mut(&mut self) -> IterMut<'_, Param>
Iterate mutably over the encapsulated parameter list
Auto Trait Implementations§
impl Freeze for DataArray
impl RefUnwindSafe for DataArray
impl Send for DataArray
impl Sync for DataArray
impl Unpin for DataArray
impl UnwindSafe for DataArray
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
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.