noodles_sam/header/record/value/
map.rs1pub mod builder;
4pub mod header;
5pub mod program;
6pub mod read_group;
7pub mod reference_sequence;
8pub mod tag;
9
10pub use self::{
11 builder::Builder, header::Header, program::Program, read_group::ReadGroup,
12 reference_sequence::ReferenceSequence, tag::Tag,
13};
14
15use bstr::BString;
16use indexmap::IndexMap;
17
18pub(crate) type OtherFields<S> = IndexMap<tag::Other<S>, BString>;
19
20pub trait Inner: Sized {
22 type StandardTag: tag::Standard;
24
25 type Builder: builder::Inner<Self>;
27}
28
29#[derive(Clone, Debug, Eq, PartialEq)]
31pub struct Map<I>
32where
33 I: Inner,
34{
35 pub(crate) inner: I,
36 pub(crate) other_fields: OtherFields<I::StandardTag>,
37}
38
39impl<I> Map<I>
40where
41 I: Inner,
42{
43 pub fn builder() -> Builder<I> {
45 Builder::default()
46 }
47
48 pub fn other_fields(&self) -> &OtherFields<I::StandardTag> {
50 &self.other_fields
51 }
52
53 pub fn other_fields_mut(&mut self) -> &mut OtherFields<I::StandardTag> {
66 &mut self.other_fields
67 }
68}
69
70impl<I> Default for Map<I>
71where
72 I: Inner + Default,
73{
74 fn default() -> Self {
75 Self {
76 inner: I::default(),
77 other_fields: OtherFields::new(),
78 }
79 }
80}