Trait SpectrumSource

Source
pub trait SpectrumSource<C = CentroidPeak, D = DeconvolutedPeak, S = MultiLayerSpectrum<C, D>>: Iterator<Item = S>{
Show 17 methods // Required methods fn reset(&mut self); fn detail_level(&self) -> &DetailLevel; fn set_detail_level(&mut self, detail_level: DetailLevel); fn get_spectrum_by_id(&mut self, id: &str) -> Option<S>; fn get_spectrum_by_index(&mut self, index: usize) -> Option<S>; fn get_index(&self) -> &OffsetIndex; fn set_index(&mut self, index: OffsetIndex); // Provided methods fn get_spectrum_by_time(&mut self, time: f64) -> Option<S> { ... } fn len(&self) -> usize { ... } fn is_empty(&self) -> bool { ... } fn _offset_of_id(&self, id: &str) -> Option<u64> { ... } fn _offset_of_index(&self, index: usize) -> Option<u64> { ... } fn _offset_of_time(&mut self, time: f64) -> Option<u64> { ... } fn iter(&mut self) -> SpectrumIterator<'_, C, D, S, Self> where Self: Sized { ... } fn get_group_by_index( &mut self, index: usize, ) -> Option<SpectrumGroup<C, D, S>> where Self: Sized { ... } fn groups( &mut self, ) -> SpectrumGroupingIterator<SpectrumIterator<'_, C, D, S, Self>, C, D, S> where Self: Sized { ... } fn into_groups(self) -> SpectrumGroupingIterator<Self, C, D, S> where Self: Sized { ... }
}
Expand description

A base trait defining the behaviors of a source of spectra.

A SpectrumSource is the basis for many data access methods in mzdata.

Required Methods§

Source

fn reset(&mut self)

Rewind the current position of the source to the beginning

Source

fn detail_level(&self) -> &DetailLevel

Get the DetailLevel the reader currently uses

Source

fn set_detail_level(&mut self, detail_level: DetailLevel)

Set the DetailLevel for the reader, changing the amount of work done immediately on loading a spectrum.

§Note

Not all readers support all detail levels, and the behavior when requesting one of those levels will depend upon the underlying reader.

Source

fn get_spectrum_by_id(&mut self, id: &str) -> Option<S>

Retrieve a spectrum by it’s native ID

Source

fn get_spectrum_by_index(&mut self, index: usize) -> Option<S>

Retrieve a spectrum by it’s integer index

Source

fn get_index(&self) -> &OffsetIndex

Access the spectrum offset index to enumerate all spectra by ID

Source

fn set_index(&mut self, index: OffsetIndex)

Set the spectrum offset index. This method shouldn’t be needed if not writing a new adapter

Provided Methods§

Source

fn get_spectrum_by_time(&mut self, time: f64) -> Option<S>

Retrieve a spectrum by its scan start time Considerably more complex than seeking by ID or index, this involves a binary search over the spectrum index and assumes that spectra are stored in chronological order.

Source

fn len(&self) -> usize

Retrieve the number of spectra in source file, usually by getting the length of the index. If the index isn’t initialized, this will be 0.

Source

fn is_empty(&self) -> bool

Source

fn _offset_of_id(&self, id: &str) -> Option<u64>

Helper method to support seeking to an ID

Source

fn _offset_of_index(&self, index: usize) -> Option<u64>

Helper method to support seeking to an index

Source

fn _offset_of_time(&mut self, time: f64) -> Option<u64>

Helper method to support seeking to a specific time. Considerably more complex than seeking by ID or index.

Source

fn iter(&mut self) -> SpectrumIterator<'_, C, D, S, Self>
where Self: Sized,

Open a new iterator over this stream

Source

fn get_group_by_index(&mut self, index: usize) -> Option<SpectrumGroup<C, D, S>>
where Self: Sized,

Get the nth SpectrumGroup from this source

Source

fn groups( &mut self, ) -> SpectrumGroupingIterator<SpectrumIterator<'_, C, D, S, Self>, C, D, S>
where Self: Sized,

Create a new SpectrumIterator over self and use that state to drive a SpectrumGroupingIterator

Source

fn into_groups(self) -> SpectrumGroupingIterator<Self, C, D, S>
where Self: Sized,

Consume self to create a SpectrumGroupingIterator. This is ideal for non-rewindable streams like io::stdin which don’t implement io::Seek

Implementors§

Source§

impl<C, D, R> SpectrumSource<C, D> for MZReaderType<R, C, D>

Source§

impl<C, D, S> SpectrumSource<C, D, S> for MemorySpectrumSource<C, D, S>

Source§

impl<C, D, S, I> SpectrumSource<C, D, S> for StreamingSpectrumIterator<C, D, S, I>
where C: CentroidLike, D: DeconvolutedCentroidLike, S: SpectrumLike<C, D>, I: Iterator<Item = S>,

Source§

impl<C, D, S, R> SpectrumSource<C, D, S> for SpectrumIterator<'_, C, D, S, R>