1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use std::convert::TryFrom;
use noodles_sam::record::quality_scores::{score, Score};
pub struct Scores<I> {
iter: I,
}
impl<I> Scores<I> {
pub(crate) fn new(iter: I) -> Self {
Self { iter }
}
}
impl<'a, I> Iterator for Scores<I>
where
I: Iterator<Item = &'a u8>,
{
type Item = Result<Score, score::TryFromUByteError>;
fn next(&mut self) -> Option<Self::Item> {
self.iter.next().cloned().map(Score::try_from)
}
fn size_hint(&self) -> (usize, Option<usize>) {
self.iter.size_hint()
}
}