pub trait PeakCollection<T: CoordinateLike<C>, C>: Index<usize>
where <Self as Index<usize>>::Output: CoordinateLike<C>,
{ // Required methods fn len(&self) -> usize; fn get_item(&self, i: usize) -> &T; fn get_slice(&self, i: Range<usize>) -> &[T]; fn iter(&self) -> impl Iterator<Item = &T> where T: 'static; fn search_by(&self, query: f64) -> Result<usize, usize>; // Provided methods fn is_empty(&self) -> bool { ... } fn _closest_peak( &self, query: f64, error_tolerance: Tolerance, i: usize ) -> Option<usize> { ... } fn search(&self, query: f64, error_tolerance: Tolerance) -> Option<usize> { ... } fn has_peak(&self, query: f64, error_tolerance: Tolerance) -> Option<&T> { ... } fn between(&self, low: f64, high: f64, error_tolerance: Tolerance) -> &[T] { ... } fn all_peaks_for(&self, query: f64, error_tolerance: Tolerance) -> &[T] { ... } }
Expand description

A trait for an ordered container of mass spectral peaks. The trait builds upon CoordinateLike.

Required Methods§

source

fn len(&self) -> usize

source

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

Implement index access

source

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

source

fn iter(&self) -> impl Iterator<Item = &T>
where T: 'static,

source

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

Most basic method for coordinate search, find the index in this collection whose coordinate value is nearest to query. The return signature is identical to slice::binary_search_by

Provided Methods§

source

fn is_empty(&self) -> bool

source

fn _closest_peak( &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 peak collection, or None.

source

fn has_peak(&self, query: f64, error_tolerance: Tolerance) -> Option<&T>

Return the peak nearest to query within error_tolerance in this peak collection, or None.

source

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

Return a slice containing all peaks between low and high coordinates within error_tolerance.

source

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

Find all peaks which could match query within error_tolerance units

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, P: IndexedCoordinate<C>, C> PeakCollection<P, C> for PeakSetView<'a, P, C>

source§

impl<P: IndexedCoordinate<C>, C> PeakCollection<P, C> for PeakSetVec<P, C>