noodles_vcf/variant/record/info/field/
value.rspub mod array;
use std::{borrow::Cow, io};
pub use self::array::Array;
#[derive(Debug)]
pub enum Value<'a> {
Integer(i32),
Float(f32),
Flag,
Character(char),
String(Cow<'a, str>),
Array(Array<'a>),
}
impl<'a> TryFrom<Value<'a>> for crate::variant::record_buf::info::field::Value {
type Error = io::Error;
fn try_from(value: Value<'a>) -> Result<Self, Self::Error> {
match value {
Value::Integer(n) => Ok(Self::Integer(n)),
Value::Float(n) => Ok(Self::Float(n)),
Value::Flag => Ok(Self::Flag),
Value::Character(c) => Ok(Self::Character(c)),
Value::String(s) => Ok(Self::String(s.into())),
Value::Array(array) => array.try_into().map(Self::Array),
}
}
}