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§
Sourcefn detail_level(&self) -> &DetailLevel
fn detail_level(&self) -> &DetailLevel
Get the DetailLevel
the reader currently uses
Sourcefn set_detail_level(&mut self, detail_level: DetailLevel)
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.
Sourcefn get_spectrum_by_id(&mut self, id: &str) -> Option<S>
fn get_spectrum_by_id(&mut self, id: &str) -> Option<S>
Retrieve a spectrum by it’s native ID
Sourcefn get_spectrum_by_index(&mut self, index: usize) -> Option<S>
fn get_spectrum_by_index(&mut self, index: usize) -> Option<S>
Retrieve a spectrum by it’s integer index
Sourcefn get_index(&self) -> &OffsetIndex
fn get_index(&self) -> &OffsetIndex
Access the spectrum offset index to enumerate all spectra by ID
Sourcefn set_index(&mut self, index: OffsetIndex)
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§
Sourcefn get_spectrum_by_time(&mut self, time: f64) -> Option<S>
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.
Sourcefn len(&self) -> usize
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.
fn is_empty(&self) -> bool
Sourcefn _offset_of_id(&self, id: &str) -> Option<u64>
fn _offset_of_id(&self, id: &str) -> Option<u64>
Helper method to support seeking to an ID
Sourcefn _offset_of_index(&self, index: usize) -> Option<u64>
fn _offset_of_index(&self, index: usize) -> Option<u64>
Helper method to support seeking to an index
Sourcefn _offset_of_time(&mut self, time: f64) -> Option<u64>
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.
Sourcefn iter(&mut self) -> SpectrumIterator<'_, C, D, S, Self> ⓘwhere
Self: Sized,
fn iter(&mut self) -> SpectrumIterator<'_, C, D, S, Self> ⓘwhere
Self: Sized,
Open a new iterator over this stream
Sourcefn get_group_by_index(&mut self, index: usize) -> Option<SpectrumGroup<C, D, S>>where
Self: Sized,
fn get_group_by_index(&mut self, index: usize) -> Option<SpectrumGroup<C, D, S>>where
Self: Sized,
Get the nth SpectrumGroup
from this source
Sourcefn groups(
&mut self,
) -> SpectrumGroupingIterator<SpectrumIterator<'_, C, D, S, Self>, C, D, S> ⓘwhere
Self: Sized,
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
Sourcefn into_groups(self) -> SpectrumGroupingIterator<Self, C, D, S> ⓘwhere
Self: Sized,
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