noodles_vcf::header::record::value::map

Struct Map

Source
pub struct Map<I>
where I: Inner,
{ /* private fields */ }
Expand description

A VCF header map value.

Implementations§

Source§

impl Map<AlternativeAllele>

Source

pub fn new<D>(description: D) -> Self
where D: Into<String>,

Creates a VCF header alternative allele map value.

§Examples
use noodles_vcf::header::record::value::{map::AlternativeAllele, Map};
let map = Map::<AlternativeAllele>::new("Deletion");
Source§

impl Map<Contig>

Source

pub fn new() -> Self

Creates a VCF header contig map value.

§Examples
use noodles_vcf::header::record::value::{map::Contig, Map};
let map = Map::<Contig>::new();
Source

pub fn length(&self) -> Option<usize>

Returns the length.

§Examples
use noodles_vcf::header::record::value::{map::Contig, Map};
let map = Map::<Contig>::new();
assert!(map.length().is_none());
Source

pub fn length_mut(&mut self) -> &mut Option<usize>

Returns a mutable reference to the length.

§Examples
use noodles_vcf::header::record::value::{map::Contig, Map};

let mut map = Map::<Contig>::new();
assert!(map.length().is_none());

*map.length_mut() = Some(8);
assert_eq!(map.length(), Some(8));
Source

pub fn md5(&self) -> Option<&str>

Returns the MD5 hexdigest.

§Examples
use noodles_vcf::header::record::value::{map::Contig, Map};
let map = Map::<Contig>::new();
assert!(map.md5().is_none());
Source

pub fn md5_mut(&mut self) -> &mut Option<String>

Returns a mutable reference to the MD5 hexdigest.

§Examples
use noodles_vcf::header::record::value::{map::Contig, Map};

let mut map = Map::<Contig>::new();
assert!(map.md5().is_none());

*map.md5_mut() = Some(String::from("d7eba311421bbc9d3ada44709dd61534"));
assert_eq!(map.md5(), Some("d7eba311421bbc9d3ada44709dd61534"));
Source

pub fn url(&self) -> Option<&str>

Returns the URL.

§Examples
use noodles_vcf::header::record::value::{map::Contig, Map};
let map = Map::<Contig>::new();
assert!(map.url().is_none());
Source

pub fn url_mut(&mut self) -> &mut Option<String>

Returns a mutable reference to the URL.

§Examples
use noodles_vcf::header::record::value::{map::Contig, Map};

let mut map = Map::<Contig>::new();
assert!(map.url().is_none());

*map.url_mut() = Some(String::from("https://example.com/reference.fa"));
assert_eq!(map.url(), Some("https://example.com/reference.fa"));
Source§

impl Map<Filter>

Source

pub fn pass() -> Self

Creates a default VCF header filter map value for “PASS”.

§Examples
use noodles_vcf::header::record::value::{map::Filter, Map};
let actual = Map::<Filter>::pass();
let expected = Map::<Filter>::new("All filters passed");
assert_eq!(actual, expected);
Source

pub fn new<D>(description: D) -> Self
where D: Into<String>,

Creates a VCF header filter map value.

§Examples
use noodles_vcf::header::record::value::{map::Filter, Map};
let map = Map::<Filter>::new("Quality below 10");
Source§

impl Map<Format>

Source

pub fn new<D>(number: Number, ty: Type, description: D) -> Self
where D: Into<String>,

Creates a VCF header format map value.

§Examples
use noodles_vcf::{
    header::record::value::{map::{format::{Number, Type}, Format}, Map},
    variant::record::samples::keys::key,
};

let id = key::GENOTYPE;
let map = Map::<Format>::new(Number::Count(1), Type::String, "Genotype");
Source§

impl Map<Info>

Source

pub fn new<D>(number: Number, ty: Type, description: D) -> Self
where D: Into<String>,

Creates a VCF header info map value.

§Examples
use noodles_vcf::{
    header::record::value::{map::{info::{Number, Type}, Info}, Map},
    variant::record::info::field::key,
};

let id = key::SAMPLES_WITH_DATA_COUNT;
let map = Map::<Info>::new(
    Number::Count(1),
    Type::Integer,
    "Number of samples with data",
);
Source§

impl Map<Other>

Source

pub fn new() -> Self

Creates a nonstandard VCF header map value.

§Examples
use noodles_vcf::header::record::value::{map::Other, Map};
let map = Map::<Other>::new();
Source§

impl<I> Map<I>
where I: Inner,

Source

pub fn builder() -> Builder<I>

Creates a VCF header map value builder.

Source

pub fn other_fields(&self) -> &IndexMap<Other<I::StandardTag>, String>

Returns the nonstandard fields in the map.

Source

pub fn other_fields_mut( &mut self, ) -> &mut IndexMap<Other<I::StandardTag>, String>

Returns a mutable reference to the nonstandard fields in the map.

§Examples
use noodles_vcf::header::record::value::{map::Filter, Map};

let tag = match "noodles".parse() {
    Ok(tag) => tag,
    Err(_) => unreachable!(),
};

let mut map = Map::<Filter>::pass();
map.other_fields_mut().insert(tag, String::from("vcf"));
Source§

impl<I> Map<I>
where I: Typed,

Source

pub fn number(&self) -> I::Number

Returns the cardinality of the field value.

Source

pub fn number_mut(&mut self) -> &mut I::Number

Returns a mutable reference to the number.

Source

pub fn ty(&self) -> I::Type

Returns the type of the field value.

Source

pub fn type_mut(&mut self) -> &mut I::Type

Returns a mutable reference to the type.

Source§

impl<I> Map<I>
where I: Described,

Source

pub fn description(&self) -> &str

Returns the description.

Source

pub fn description_mut(&mut self) -> &mut String

Returns a mutable reference to the description.

Source§

impl<I> Map<I>
where I: Indexed,

Source

pub fn idx(&self) -> Option<usize>

Returns the index of the ID in the dictionary of strings.

Source

pub fn idx_mut(&mut self) -> &mut Option<usize>

Returns a mutable reference to the index.

Trait Implementations§

Source§

impl<I> Clone for Map<I>
where I: Inner + Clone, I::StandardTag: Clone,

Source§

fn clone(&self) -> Map<I>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<I> Debug for Map<I>
where I: Inner + Debug, I::StandardTag: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<I> Default for Map<I>
where I: Inner + Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<&str> for Map<Format>

Source§

fn from(key: &str) -> Self

Converts to this type from the input type.
Source§

impl From<&str> for Map<Info>

Source§

fn from(key: &str) -> Self

Converts to this type from the input type.
Source§

impl From<(FileFormat, &str)> for Map<Format>

Source§

fn from((file_format, key): (FileFormat, &str)) -> Self

Converts to this type from the input type.
Source§

impl From<(FileFormat, &str)> for Map<Info>

Source§

fn from((file_format, key): (FileFormat, &str)) -> Self

Converts to this type from the input type.
Source§

impl<I> PartialEq for Map<I>

Source§

fn eq(&self, other: &Map<I>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<I> Eq for Map<I>
where I: Inner + Eq, I::StandardTag: Eq,

Source§

impl<I> StructuralPartialEq for Map<I>
where I: Inner,

Auto Trait Implementations§

§

impl<I> Freeze for Map<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for Map<I>

§

impl<I> Send for Map<I>
where I: Send, <I as Inner>::StandardTag: Send,

§

impl<I> Sync for Map<I>
where I: Sync, <I as Inner>::StandardTag: Sync,

§

impl<I> Unpin for Map<I>
where I: Unpin, <I as Inner>::StandardTag: Unpin,

§

impl<I> UnwindSafe for Map<I>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.