Skip to main content

BuildFromArrayMap

Trait BuildFromArrayMap 

Source
pub trait BuildFromArrayMap: Sized {
    // Required method
    fn try_from_arrays(
        arrays: &BinaryArrayMap,
    ) -> Result<Vec<Self>, ArrayRetrievalError>;

    // Provided methods
    fn arrays_required() -> Option<Vec<ArrayType>> { ... }
    fn from_arrays(arrays: &BinaryArrayMap) -> Vec<Self> { ... }
    fn has_arrays_for(arrays: &BinaryArrayMap) -> ArraysAvailable { ... }
}
Expand description

A trait for reconstructing a Vec of peaks or features from a BinaryArrayMap.

This is the inverse of BuildArrayMapFrom.

§Examples

use mzpeaks::CentroidPeak;
use mzdata_bindata::{ArraysAvailable, BinaryArrayMap, BuildFromArrayMap};

let empty = BinaryArrayMap::new();
assert!(matches!(
    CentroidPeak::has_arrays_for(&empty),
    ArraysAvailable::MissingArrays(_)
));

Required Methods§

Source

fn try_from_arrays( arrays: &BinaryArrayMap, ) -> Result<Vec<Self>, ArrayRetrievalError>

Try to build a Vec of Self from a BinaryArrayMap.

If arrays are absent or malformed, returns ArrayRetrievalError

Provided Methods§

Source

fn arrays_required() -> Option<Vec<ArrayType>>

The arrays that are required to reconstruct this type

The default implementation returns None.

Source

fn from_arrays(arrays: &BinaryArrayMap) -> Vec<Self>

A shortcut form of Self::try_from_arrays that panics if it fails

Source

fn has_arrays_for(arrays: &BinaryArrayMap) -> ArraysAvailable

A pre-emptive check for the presence of the required arrays.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl BuildFromArrayMap for CentroidPeak

Source§

impl BuildFromArrayMap for ChargedFeature<Mass, IonMobility>

ChargedFeature with an IonMobility dimension implement BuildFromArrayMap.

It requires a non-standard “feature identifier array” which assigns a unique integer identifier to all points belonging to the same Feature.

Like DeconvolutedPeak, ChargedFeature will compute its neutral mass from m/z and assumes that the charge carrier is a proton.

While it explicitly requires ArrayType::RawIonMobilityArray, it will accept any raw ion mobility array type.

Source§

impl BuildFromArrayMap for DeconvolutedPeak

The basic DeconvolutedPeak implements BuildFromArrayMap.

It assumes that the charge carrier was a proton when converting to neutral mass from ArrayType::MZArray.

Source§

impl BuildFromArrayMap for Feature<MZ, IonMobility>

Feature with an IonMobility dimension implement BuildFromArrayMap.

It requires a non-standard “feature identifier array” which assigns a unique integer identifier to all points belonging to the same Feature.

While it explicitly requires ArrayType::RawIonMobilityArray, it will accept any raw ion mobility array type.

Source§

impl BuildFromArrayMap for IonMobilityAwareCentroidPeak

TODO

Source§

impl BuildFromArrayMap for IonMobilityAwareDeconvolutedPeak

TODO

Implementors§