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§
Sourcefn try_from_arrays(
arrays: &BinaryArrayMap,
) -> Result<Vec<Self>, ArrayRetrievalError>
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§
Sourcefn arrays_required() -> Option<Vec<ArrayType>>
fn arrays_required() -> Option<Vec<ArrayType>>
The arrays that are required to reconstruct this type
The default implementation returns None.
Sourcefn from_arrays(arrays: &BinaryArrayMap) -> Vec<Self>
fn from_arrays(arrays: &BinaryArrayMap) -> Vec<Self>
A shortcut form of Self::try_from_arrays that panics if it fails
Sourcefn has_arrays_for(arrays: &BinaryArrayMap) -> ArraysAvailable
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
impl BuildFromArrayMap for CentroidPeak
Source§fn arrays_required() -> Option<Vec<ArrayType>>
fn arrays_required() -> Option<Vec<ArrayType>>
CentroidPeak requires ArrayType::MZArray and ArrayType::IntensityArray
fn try_from_arrays( arrays: &BinaryArrayMap, ) -> Result<Vec<Self>, ArrayRetrievalError>
Source§impl BuildFromArrayMap for ChargedFeature<Mass, IonMobility>
ChargedFeature with an IonMobility dimension implement
BuildFromArrayMap.
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§fn arrays_required() -> Option<Vec<ArrayType>>
fn arrays_required() -> Option<Vec<ArrayType>>
ChargedFeature requires ArrayType::MZArray, ArrayType::ChargeArray and ArrayType::IntensityArray,
ArrayType::RawIonMobilityArray, and a non-standard “feature identifier array”
fn try_from_arrays( arrays: &BinaryArrayMap, ) -> Result<Vec<Self>, ArrayRetrievalError>
Source§impl BuildFromArrayMap for DeconvolutedPeak
The basic DeconvolutedPeak implements BuildFromArrayMap.
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.
fn try_from_arrays( arrays: &BinaryArrayMap, ) -> Result<Vec<Self>, ArrayRetrievalError>
Source§impl BuildFromArrayMap for Feature<MZ, IonMobility>
Feature with an IonMobility dimension implement
BuildFromArrayMap.
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§fn arrays_required() -> Option<Vec<ArrayType>>
fn arrays_required() -> Option<Vec<ArrayType>>
Feature requires ArrayType::MZArray and ArrayType::IntensityArray,
ArrayType::RawIonMobilityArray, and a non-standard “feature identifier array”
fn try_from_arrays( arrays: &BinaryArrayMap, ) -> Result<Vec<Self>, ArrayRetrievalError>
Source§impl BuildFromArrayMap for IonMobilityAwareCentroidPeak
TODO
impl BuildFromArrayMap for IonMobilityAwareCentroidPeak
TODO
fn try_from_arrays( arrays: &BinaryArrayMap, ) -> Result<Vec<Self>, ArrayRetrievalError>
fn arrays_required() -> Option<Vec<ArrayType>>
Source§impl BuildFromArrayMap for IonMobilityAwareDeconvolutedPeak
TODO
impl BuildFromArrayMap for IonMobilityAwareDeconvolutedPeak
TODO