pub struct Info(_);
Expand description

VCF record information fields (INFO).

Implementations

Parses raw VCF record info.

Returns the number of info fields.

Examples
use noodles_vcf::record::Info;
let info = Info::default();
assert_eq!(info.len(), 0);

Returns whether there are any info fields.

Examples
use noodles_vcf::record::Info;
let info = Info::default();
assert!(info.is_empty());

Removes all field from the info map.

This does not affect the capacity of the map.

Examples
use noodles_vcf::{
    header::info::Key,
    record::{info::{field::Value, Field}, Info},
};

let ns = Field::new(Key::SamplesWithDataCount, Some(Value::Integer(2)));
let dp = Field::new(Key::TotalDepth, Some(Value::Integer(13)));
let mut info = Info::try_from(vec![ns, dp])?;
assert!(!info.is_empty());

info.clear();
assert!(info.is_empty());

Returns a reference to the field with the given key.

Examples
use noodles_vcf::{
    header::info::Key,
    record::{info::{field::Value, Field}, Info},
};

let ns = Field::new(Key::SamplesWithDataCount, Some(Value::Integer(2)));
let dp = Field::new(Key::TotalDepth, Some(Value::Integer(13)));
let info = Info::try_from(vec![ns, dp.clone()])?;

assert_eq!(info.get(&Key::TotalDepth), Some(&dp));
assert!(info.get(&Key::AlleleFrequencies).is_none());

Returns a mutable reference to the field with the given key.

Examples
use noodles_vcf::{
    header::info::Key,
    record::{info::{field::Value, Field}, Info},
};

let ns = Field::new(Key::SamplesWithDataCount, Some(Value::Integer(2)));
let dp = Field::new(Key::TotalDepth, Some(Value::Integer(13)));
let mut info = Info::try_from(vec![ns, dp])?;

if let Some(dp) = info.get_mut(&Key::TotalDepth) {
    *dp.value_mut() = Some(Value::Integer(8));
}

assert_eq!(
    info.get(&Key::TotalDepth).map(|field| field.value()),
    Some(Some(&Value::Integer(8)))
);

Returns a reference to the field at the given index.

Examples
use noodles_vcf::{
    header::info::Key,
    record::{info::{field::Value, Field}, Info},
};

let ns = Field::new(Key::SamplesWithDataCount, Some(Value::Integer(2)));
let dp = Field::new(Key::TotalDepth, Some(Value::Integer(13)));
let info = Info::try_from(vec![ns, dp.clone()])?;

assert_eq!(info.get_index(1), Some(&dp));
assert!(info.get_index(5).is_none());

Returns a mutable reference to the field at the given index.

Examples
use noodles_vcf::{
    header::info::Key,
    record::{info::{field::Value, Field}, Info},
};

let ns = Field::new(Key::SamplesWithDataCount, Some(Value::Integer(2)));
let dp = Field::new(Key::TotalDepth, Some(Value::Integer(13)));
let mut info = Info::try_from(vec![ns, dp])?;

if let Some(dp) = info.get_index_mut(1) {
    *dp.value_mut() = Some(Value::Integer(8));
}

assert_eq!(
    info.get_index(1).map(|field| field.value()),
    Some(Some(&Value::Integer(8)))
);

Inserts a field into the info.

This uses the field key as the key and field as the value.

If the key already exists in the map, the existing field is replaced by the new one, and the existing field is returned.

Examples
use noodles_vcf::{
    header::info::Key,
    record::{info::{field::Value, Field}, Info},
};

let ns = Field::new(Key::SamplesWithDataCount, Some(Value::Integer(2)));
let mut info = Info::try_from(vec![ns])?;
assert_eq!(info.len(), 1);

let dp = Field::new(Key::TotalDepth, Some(Value::Integer(13)));
info.insert(dp.clone());

assert_eq!(info.len(), 2);
assert_eq!(info.get(&Key::TotalDepth), Some(&dp));

Returns an iterator over all keys.

Examples
use noodles_vcf::{
    header::info::Key,
    record::{info::{field::Value, Field}, Info},
};

let ns = Field::new(Key::SamplesWithDataCount, Some(Value::Integer(2)));
let dp = Field::new(Key::TotalDepth, Some(Value::Integer(13)));
let info = Info::try_from(vec![ns, dp.clone()])?;

let mut keys = info.keys();

assert_eq!(keys.next(), Some(&Key::SamplesWithDataCount));
assert_eq!(keys.next(), Some(&Key::TotalDepth));
assert!(keys.next().is_none());

Returns an iterator over all fields.

Examples
use noodles_vcf::{
    header::info::Key,
    record::{info::{field::Value, Field}, Info},
};

let ns = Field::new(Key::SamplesWithDataCount, Some(Value::Integer(2)));
let dp = Field::new(Key::TotalDepth, Some(Value::Integer(13)));
let info = Info::try_from(vec![ns.clone(), dp.clone()])?;

let mut values = info.values();

assert_eq!(values.next(), Some(&ns));
assert_eq!(values.next(), Some(&dp));
assert!(values.next().is_none());

Trait Implementations

Converts this type into a mutable reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more