pub struct Field { /* private fields */ }
Expand description
A VCF record info field.
Implementations§
source§impl Field
impl Field
sourcepub fn try_from_str(s: &str, infos: &Infos) -> Result<Self, ParseError>
pub fn try_from_str(s: &str, infos: &Infos) -> Result<Self, ParseError>
Parses a raw VCF record info field.
sourcepub fn new(key: Key, value: Option<Value>) -> Self
pub fn new(key: Key, value: Option<Value>) -> Self
Creates a VCF record info field.
Examples
use noodles_vcf::{
header::info::Key,
record::info::{field::Value, Field},
};
let field = Field::new(Key::SamplesWithDataCount, Some(Value::Integer(1)));
sourcepub fn key(&self) -> &Key
pub fn key(&self) -> &Key
Returns the field key.
Examples
use noodles_vcf::{
header::info::Key,
record::info::{field::Value, Field},
};
let field = Field::new(Key::SamplesWithDataCount, Some(Value::Integer(1)));
assert_eq!(field.key(), &Key::SamplesWithDataCount);
sourcepub fn value(&self) -> Option<&Value>
pub fn value(&self) -> Option<&Value>
Returns the field value.
Examples
use noodles_vcf::{
header::info::Key,
record::info::{field::Value, Field},
};
let field = Field::new(Key::SamplesWithDataCount, Some(Value::Integer(1)));
assert_eq!(field.value(), Some(&Value::Integer(1)));
sourcepub fn value_mut(&mut self) -> &mut Option<Value>
pub fn value_mut(&mut self) -> &mut Option<Value>
Returns a mutable reference to the value.
Examples
use noodles_vcf::{
header::info::Key,
record::info::{field::Value, Field},
};
let mut field = Field::new(Key::SamplesWithDataCount, Some(Value::Integer(1)));
*field.value_mut() = Some(Value::Integer(2));
assert_eq!(field.value(), Some(&Value::Integer(2)));