Struct mzpeaks::feature_map::FeatureMap
source · pub struct FeatureMap<X, Y, T: FeatureLike<X, Y>> { /* private fields */ }
Expand description
Represents a sorted list of mass spectral features that is a concrete implementation
of FeatureMapLike
and FeatureMapLikeMut
Implementations§
source§impl<'a, X, Y, T: FeatureLike<X, Y>> FeatureMap<X, Y, T>
impl<'a, X, Y, T: FeatureLike<X, Y>> FeatureMap<X, Y, T>
sourcepub fn new(features: Vec<T>) -> Self
pub fn new(features: Vec<T>) -> Self
Create a new FeatureMap
from an existing Vec<T>
and sorts
the newly created structure to ensure it is ordered by coordinate X
pub fn empty() -> Self
sourcepub fn wrap(features: Vec<T>) -> Self
pub fn wrap(features: Vec<T>) -> Self
Create a new FeatureMap
from an existing Vec<T>
, but does not actively
sort the collection. It is up to the caller to ensure that the provided Vec
is sorted or that it will be sorted prior to any of its search functionality
is used.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn search_by(&self, query: f64) -> Result<usize, usize>
sourcepub fn spanning(&'a self, y: f64) -> FeatureMap<X, Y, &T>
pub fn spanning(&'a self, y: f64) -> FeatureMap<X, Y, &T>
Extract a subset of this FeatureMap
that overlap the specified y
coordinate
pub fn from_iter<I: Iterator<Item = T>>(iter: I, sort: bool) -> Self
Trait Implementations§
source§impl<X: Clone, Y: Clone, T: Clone + FeatureLike<X, Y>> Clone for FeatureMap<X, Y, T>
impl<X: Clone, Y: Clone, T: Clone + FeatureLike<X, Y>> Clone for FeatureMap<X, Y, T>
source§fn clone(&self) -> FeatureMap<X, Y, T>
fn clone(&self) -> FeatureMap<X, Y, T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<X: Debug, Y: Debug, T: Debug + FeatureLike<X, Y>> Debug for FeatureMap<X, Y, T>
impl<X: Debug, Y: Debug, T: Debug + FeatureLike<X, Y>> Debug for FeatureMap<X, Y, T>
source§impl<X: Default, Y: Default, T: Default + FeatureLike<X, Y>> Default for FeatureMap<X, Y, T>
impl<X: Default, Y: Default, T: Default + FeatureLike<X, Y>> Default for FeatureMap<X, Y, T>
source§fn default() -> FeatureMap<X, Y, T>
fn default() -> FeatureMap<X, Y, T>
Returns the “default value” for a type. Read more
source§impl<X, Y, T: FeatureLike<X, Y>> FeatureMapLike<X, Y, T> for FeatureMap<X, Y, T>
impl<X, Y, T: FeatureLike<X, Y>> FeatureMapLike<X, Y, T> for FeatureMap<X, Y, T>
fn search_by(&self, query: f64) -> Result<usize, usize>
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn get_slice(&self, i: Range<usize>) -> &[T]
fn _closest_feature( &self, query: f64, error_tolerance: Tolerance, i: usize ) -> Option<usize>
source§fn search(&self, query: f64, error_tolerance: Tolerance) -> Option<usize>
fn search(&self, query: f64, error_tolerance: Tolerance) -> Option<usize>
Find the nearest index for
query
within error_tolerance
in
this feature collection, or None
.source§fn has_feature(&self, query: f64, error_tolerance: Tolerance) -> Option<&T>
fn has_feature(&self, query: f64, error_tolerance: Tolerance) -> Option<&T>
Return the feature nearest to
query
within error_tolerance
in
this feature collection, or None
.source§impl<X, Y, T: FeatureLike<X, Y>> FeatureMapLikeMut<X, Y, T> for FeatureMap<X, Y, T>
impl<X, Y, T: FeatureLike<X, Y>> FeatureMapLikeMut<X, Y, T> for FeatureMap<X, Y, T>
source§impl<X, Y, T: FeatureLike<X, Y>> FromIterator<T> for FeatureMap<X, Y, T>
impl<X, Y, T: FeatureLike<X, Y>> FromIterator<T> for FeatureMap<X, Y, T>
source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
source§impl<X, Y, T: FeatureLike<X, Y>> Index<Range<usize>> for FeatureMap<X, Y, T>
impl<X, Y, T: FeatureLike<X, Y>> Index<Range<usize>> for FeatureMap<X, Y, T>
source§impl<X, Y, T: FeatureLike<X, Y>> Index<RangeFrom<usize>> for FeatureMap<X, Y, T>
impl<X, Y, T: FeatureLike<X, Y>> Index<RangeFrom<usize>> for FeatureMap<X, Y, T>
source§impl<X, Y, T: FeatureLike<X, Y>> Index<RangeFull> for FeatureMap<X, Y, T>
impl<X, Y, T: FeatureLike<X, Y>> Index<RangeFull> for FeatureMap<X, Y, T>
source§impl<X, Y, T: FeatureLike<X, Y>> Index<RangeTo<usize>> for FeatureMap<X, Y, T>
impl<X, Y, T: FeatureLike<X, Y>> Index<RangeTo<usize>> for FeatureMap<X, Y, T>
source§impl<X, Y, T: FeatureLike<X, Y>> Index<usize> for FeatureMap<X, Y, T>
impl<X, Y, T: FeatureLike<X, Y>> Index<usize> for FeatureMap<X, Y, T>
Auto Trait Implementations§
impl<X, Y, T> RefUnwindSafe for FeatureMap<X, Y, T>
impl<X, Y, T> Send for FeatureMap<X, Y, T>
impl<X, Y, T> Sync for FeatureMap<X, Y, T>
impl<X, Y, T> Unpin for FeatureMap<X, Y, T>
impl<X, Y, T> UnwindSafe for FeatureMap<X, Y, T>
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