Skip to content

Commit

Permalink
sam/lazy/record/quality_scores: Implement crate::alignment::record::Q…
Browse files Browse the repository at this point in the history
…ualityScores for QualityScores
  • Loading branch information
zaeleus committed Dec 14, 2023
1 parent b72f33b commit bc181e1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions noodles-sam/src/lazy/record/quality_scores.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ impl<'a> QualityScores<'a> {
}
}

impl<'a> crate::alignment::record::QualityScores for QualityScores<'a> {
fn is_empty(&self) -> bool {
self.is_empty()
}

fn len(&self) -> usize {
self.len()
}

fn iter(&self) -> Box<dyn Iterator<Item = u8> + '_> {
const OFFSET: u8 = b'!';
Box::new(self.as_ref().iter().map(|&b| b - OFFSET))
}
}

impl<'a> AsRef<[u8]> for QualityScores<'a> {
fn as_ref(&self) -> &[u8] {
self.0
Expand Down

0 comments on commit bc181e1

Please sign in to comment.