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>

source

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

source

pub fn empty() -> Self

source

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.

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

source

pub fn iter(&self) -> Iter<'_, T>

Iterate over references to features

source

pub fn iter_mut(&'a mut self) -> IterMut<'a, T>

Iterate over mutable reference to features

source

pub fn search_by(&self, query: f64) -> Result<usize, usize>

source

pub fn spanning(&'a self, y: f64) -> FeatureMap<X, Y, &T>

Extract a subset of this FeatureMap that overlap the specified y coordinate

source

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>

source§

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)

Performs copy-assignment from source. Read more
source§

impl<X: Debug, Y: Debug, T: Debug + FeatureLike<X, Y>> Debug for FeatureMap<X, Y, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<X: Default, Y: Default, T: Default + FeatureLike<X, Y>> Default for FeatureMap<X, Y, T>

source§

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>

source§

fn search_by(&self, query: f64) -> Result<usize, usize>

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn get_item(&self, i: usize) -> &T

Implement index access
source§

fn get_slice(&self, i: Range<usize>) -> &[T]

source§

fn _closest_feature( &self, query: f64, error_tolerance: Tolerance, i: usize ) -> Option<usize>

source§

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>

Return the feature nearest to query within error_tolerance in this feature collection, or None.
source§

fn between(&self, low: f64, high: f64, error_tolerance: Tolerance) -> &[T]

Return a slice containing all features between low and high coordinates within error_tolerance.
source§

fn all_features_for(&self, query: f64, error_tolerance: Tolerance) -> &[T]

Find all features which could match query within error_tolerance units
source§

impl<X, Y, T: FeatureLike<X, Y>> FeatureMapLikeMut<X, Y, T> for FeatureMap<X, Y, T>

source§

fn push(&mut self, feature: T)

Add feature to the collection, maintaining sort order and feature indexing.
source§

fn sort(&mut self)

Sort the collection, updating the feature indexing.
source§

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

Creates a value from an iterator. Read more
source§

impl<X, Y, T: FeatureLike<X, Y>> Index<Range<usize>> for FeatureMap<X, Y, T>

§

type Output = [<FeatureMap<X, Y, T> as Index<usize>>::Output]

The returned type after indexing.
source§

fn index(&self, index: Range<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<X, Y, T: FeatureLike<X, Y>> Index<RangeFrom<usize>> for FeatureMap<X, Y, T>

§

type Output = [<FeatureMap<X, Y, T> as Index<usize>>::Output]

The returned type after indexing.
source§

fn index(&self, index: RangeFrom<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<X, Y, T: FeatureLike<X, Y>> Index<RangeFull> for FeatureMap<X, Y, T>

§

type Output = [<FeatureMap<X, Y, T> as Index<usize>>::Output]

The returned type after indexing.
source§

fn index(&self, _: RangeFull) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<X, Y, T: FeatureLike<X, Y>> Index<RangeTo<usize>> for FeatureMap<X, Y, T>

§

type Output = [<FeatureMap<X, Y, T> as Index<usize>>::Output]

The returned type after indexing.
source§

fn index(&self, index: RangeTo<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<X, Y, T: FeatureLike<X, Y>> Index<usize> for FeatureMap<X, Y, T>

§

type Output = T

The returned type after indexing.
source§

fn index(&self, i: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<X, Y, T: FeatureLike<X, Y>> IndexMut<usize> for FeatureMap<X, Y, T>

source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<X, Y, T> RefUnwindSafe for FeatureMap<X, Y, T>

§

impl<X, Y, T> Send for FeatureMap<X, Y, T>
where T: Send, X: Send, Y: Send,

§

impl<X, Y, T> Sync for FeatureMap<X, Y, T>
where T: Sync, X: Sync, Y: Sync,

§

impl<X, Y, T> Unpin for FeatureMap<X, Y, T>
where T: Unpin, X: Unpin, Y: Unpin,

§

impl<X, Y, T> UnwindSafe for FeatureMap<X, Y, T>
where T: UnwindSafe, X: UnwindSafe, Y: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.