noodles_vcf/header/record/
value.rs

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
32
33
//! VCF header record value.

pub mod collection;
pub mod map;

pub use self::{collection::Collection, map::Map};

/// A VCF header record other value.
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Value {
    /// A string.
    String(String),
    /// A map.
    Map(String, Map<map::Other>),
}

impl From<&str> for Value {
    fn from(s: &str) -> Self {
        Self::String(s.into())
    }
}

impl From<String> for Value {
    fn from(s: String) -> Self {
        Self::String(s)
    }
}

impl From<(String, Map<map::Other>)> for Value {
    fn from((id, map): (String, Map<map::Other>)) -> Self {
        Self::Map(id, map)
    }
}