pub trait BuildArrayMapFrom: Sized {
// Required method
fn as_arrays(source: &[Self]) -> BinaryArrayMap;
// Provided method
fn arrays_included(&self) -> Option<Vec<ArrayType>> { ... }
}Expand description
A trait for converting a slice of peaks or features into a BinaryArrayMap.
This is the inverse of BuildFromArrayMap.
§Examples
use mzpeaks::CentroidPeak;
use mzdata_bindata::{ArrayType, BuildArrayMapFrom, BuildFromArrayMap};
let peaks = vec![
CentroidPeak::new(500.0, 1200.0, 0),
CentroidPeak::new(750.5, 800.0, 1),
];
let arrays = CentroidPeak::as_arrays(&peaks);
assert!(arrays.has_array(&ArrayType::MZArray));
assert!(arrays.has_array(&ArrayType::IntensityArray));
let roundtripped = CentroidPeak::try_from_arrays(&arrays).unwrap();
assert_eq!(roundtripped.len(), 2);
assert_eq!(roundtripped[0].mz, 500.0);Required Methods§
Sourcefn as_arrays(source: &[Self]) -> BinaryArrayMap
fn as_arrays(source: &[Self]) -> BinaryArrayMap
Serialize a slice of Self into a BinaryArrayMap.
This assumes that the operation cannot fail as all the data is available in memory already.
Provided Methods§
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 BuildArrayMapFrom for CentroidPeak
The basic CentroidPeak implements BuildArrayMapFrom
impl BuildArrayMapFrom for CentroidPeak
The basic CentroidPeak implements BuildArrayMapFrom
Source§fn arrays_included(&self) -> Option<Vec<ArrayType>>
fn arrays_included(&self) -> Option<Vec<ArrayType>>
CentroidPeak produces ArrayType::MZArray and ArrayType::IntensityArray
fn as_arrays(source: &[CentroidPeak]) -> BinaryArrayMap
Source§impl BuildArrayMapFrom for ChargedFeature<Mass, IonMobility>
ChargedFeature with an IonMobility dimension implement
BuildArrayMapFrom.
impl BuildArrayMapFrom for ChargedFeature<Mass, IonMobility>
ChargedFeature with an IonMobility dimension implement
BuildArrayMapFrom.
It uses a non-standard “feature identifier array” which assigns
a unique integer identifier to all points belonging to the same
Feature.
It also produces ArrayType::RawIonMobilityArray which does not have
an associated Unit. The caller should update this if context is available.
Source§fn arrays_included(&self) -> Option<Vec<ArrayType>>
fn arrays_included(&self) -> Option<Vec<ArrayType>>
ChargedFeature produces ArrayType::MZArray, ArrayType::ChargeArray,
ArrayType::IntensityArray, ArrayType::RawIonMobilityArray, and a
non-standard “feature identifier array”
Source§fn as_arrays(source: &[ChargedFeature<Mass, IonMobility>]) -> BinaryArrayMap
fn as_arrays(source: &[ChargedFeature<Mass, IonMobility>]) -> BinaryArrayMap
ChargedFeature uses a non-standard “feature identifier array” which assigns
a unique integer identifier to all points belonging to the same
ChargedFeature.
Like DeconvolutedPeak, ChargedFeature will compute its m/z value from
neutral mass and charge, and assumes that the charge carrier is a proton.
It also produces ArrayType::RawIonMobilityArray which does not have
an associated Unit. The caller should update these for consistency
Source§impl BuildArrayMapFrom for DeconvolutedPeak
The basic DeconvolutedPeak implements BuildArrayMapFrom.
impl BuildArrayMapFrom for DeconvolutedPeak
The basic DeconvolutedPeak implements BuildArrayMapFrom.
It produces the much more common ArrayType::MZArray instead of
[ArrayType::MassArray] for compatibility with other tools, and assumes
that the charge carrier is a proton.
fn as_arrays(source: &[DeconvolutedPeak]) -> BinaryArrayMap
Source§impl BuildArrayMapFrom for Feature<MZ, IonMobility>
Feature with an IonMobility dimension implement
BuildArrayMapFrom.
impl BuildArrayMapFrom for Feature<MZ, IonMobility>
Feature with an IonMobility dimension implement
BuildArrayMapFrom.
It uses a non-standard “feature identifier array” which assigns
a unique integer identifier to all points belonging to the same
Feature.
It also produces ArrayType::RawIonMobilityArray which does not have
an associated Unit. The caller should update this if context is available.
Source§fn arrays_included(&self) -> Option<Vec<ArrayType>>
fn arrays_included(&self) -> Option<Vec<ArrayType>>
Feature produces ArrayType::MZArray and ArrayType::IntensityArray,
ArrayType::RawIonMobilityArray, and a non-standard “feature identifier array”
Source§fn as_arrays(source: &[Feature<MZ, IonMobility>]) -> BinaryArrayMap
fn as_arrays(source: &[Feature<MZ, IonMobility>]) -> BinaryArrayMap
Feature uses a non-standard “feature identifier array” which assigns
a unique integer identifier to all points belonging to the same
Feature.
It also produces ArrayType::RawIonMobilityArray which does not have
an associated Unit. The caller should update these for consistency
Source§impl BuildArrayMapFrom for FittedPeak
Available on crate feature mzsignal only.mzsignal::FittedPeak implements BuildArrayMapFrom, which will
produce ArrayType::MZArray, ArrayType::IntensityArray, and
ArrayType::SignalToNoiseArray. All other properties will be lost
impl BuildArrayMapFrom for FittedPeak
mzsignal only.mzsignal::FittedPeak implements BuildArrayMapFrom, which will
produce ArrayType::MZArray, ArrayType::IntensityArray, and
ArrayType::SignalToNoiseArray. All other properties will be lost
fn arrays_included(&self) -> Option<Vec<ArrayType>>
fn as_arrays(source: &[FittedPeak]) -> BinaryArrayMap
Source§impl BuildArrayMapFrom for IonMobilityAwareCentroidPeak
TODO
impl BuildArrayMapFrom for IonMobilityAwareCentroidPeak
TODO
fn arrays_included(&self) -> Option<Vec<ArrayType>>
fn as_arrays(source: &[IonMobilityAwareCentroidPeak]) -> BinaryArrayMap
Source§impl BuildArrayMapFrom for IonMobilityAwareDeconvolutedPeak
TODO
impl BuildArrayMapFrom for IonMobilityAwareDeconvolutedPeak
TODO