noodles_sam/alignment/record/
data.rs

1//! Alignment record data.
2
3pub mod field;
4
5use std::io;
6
7use self::field::{Tag, Value};
8
9/// Alignment record data.
10pub trait Data {
11    /// Returns whether there are any fields.
12    fn is_empty(&self) -> bool;
13
14    /// Returns the value for the given tag.
15    fn get(&self, tag: &Tag) -> Option<io::Result<Value<'_>>>;
16
17    /// Returns an iterator over fields.
18    fn iter(&self) -> Box<dyn Iterator<Item = io::Result<(Tag, Value<'_>)>> + '_>;
19}
20
21impl Data for Box<dyn Data + '_> {
22    fn is_empty(&self) -> bool {
23        (**self).is_empty()
24    }
25
26    fn get(&self, tag: &Tag) -> Option<io::Result<Value<'_>>> {
27        (**self).get(tag)
28    }
29
30    fn iter(&self) -> Box<dyn Iterator<Item = io::Result<(Tag, Value<'_>)>> + '_> {
31        (**self).iter()
32    }
33}