Trait mzdata::io::MZFileReader
source · pub trait MZFileReader<C: CentroidLike + Default = CentroidPeak, D: DeconvolutedCentroidLike + Default = DeconvolutedPeak, S: SpectrumLike<C, D> = MultiLayerSpectrum<C, D>>: SpectrumSource<C, D, S> + Sized {
// Required methods
fn construct_index_from_stream(&mut self) -> u64;
fn open_file(source: File) -> Result<Self>;
// Provided methods
fn read_index(&mut self, reader: Box<dyn Read>) -> Result<&Self, Error> { ... }
fn write_index(&self, writer: Box<dyn Write>) -> Result<&Self, Error> { ... }
fn open_path<P>(path: P) -> Result<Self>
where P: Into<PathBuf> + Clone { ... }
}
Expand description
A trait defining some helper methods to make efficient use of indices automatic when opening a file from a path-like object.
Required Methods§
sourcefn construct_index_from_stream(&mut self) -> u64
fn construct_index_from_stream(&mut self) -> u64
An on-trait method of constructing an index. Assumed to be a trivial wrapper.
Provided Methods§
sourcefn read_index(&mut self, reader: Box<dyn Read>) -> Result<&Self, Error>
fn read_index(&mut self, reader: Box<dyn Read>) -> Result<&Self, Error>
Re-construct an offset index from this readable object, assuming it is a JSON stream over the serialized index.
fn write_index(&self, writer: Box<dyn Write>) -> Result<&Self, Error>
sourcefn open_path<P>(path: P) -> Result<Self>
fn open_path<P>(path: P) -> Result<Self>
The preferred method of opening a file from a path-like object. This method will open the file at the provided path, test whether there is an accompanied index file next to it on the file system, and if not, build one and save it or otherwise read in the index.
The index building process is usually neglible on “regular” IO file systems.
Object Safety§
This trait is not object safe.