Skip to content

Commit

Permalink
Fix: port #5 to all other reader types
Browse files Browse the repository at this point in the history
  • Loading branch information
mobiusklein committed Aug 23, 2024
1 parent fe4b6ad commit 5eabab9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/io/mzml/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,7 @@ impl<

/// Retrieve a spectrum by it's native ID
pub async fn get_spectrum_by_id(&mut self, id: &str) -> Option<MultiLayerSpectrum<C, D>> {
let offset_ref = self.index.get(id);
let offset = offset_ref.expect("Failed to retrieve offset");
let offset = self.index.get(id)?;
let start = self
.handle
.stream_position()
Expand Down
3 changes: 1 addition & 2 deletions src/io/mzml/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1553,8 +1553,7 @@ impl<
{
/// Retrieve a spectrum by it's native ID
fn get_spectrum_by_id(&mut self, id: &str) -> Option<MultiLayerSpectrum<C, D>> {
let offset_ref = self.spectrum_index.get(id);
let offset = offset_ref.expect("Failed to retrieve offset");
let offset = self.spectrum_index.get(id)?;
let start = self
.handle
.stream_position()
Expand Down
3 changes: 1 addition & 2 deletions src/io/mzmlb/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,8 +1082,7 @@ impl<
{
/// Retrieve a spectrum by it's native ID
fn get_spectrum_by_id(&mut self, id: &str) -> Option<MultiLayerSpectrum<C, D>> {
let offset_ref = self.spectrum_index.get(id);
let offset = offset_ref.expect("Failed to retrieve offset");
let offset = self.spectrum_index.get(id)?;
let start = self
.mzml_parser
.stream_position()
Expand Down

0 comments on commit 5eabab9

Please sign in to comment.