pub struct Contig { /* private fields */ }
Expand description
A VCF header contig record (contig
).
Implementations
sourceimpl Contig
impl Contig
sourcepub fn new<S>(id: S) -> Self where
S: Into<String>,
pub fn new<S>(id: S) -> Self where
S: Into<String>,
Creates a VCF header contig record.
Examples
use noodles_vcf::header::Contig;
let contig = Contig::new("sq0");
sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
Returns the ID of the contig.
Examples
use noodles_vcf::header::Contig;
let contig = Contig::new("sq0");
assert_eq!(contig.id(), "sq0");
sourcepub fn len(&self) -> Option<i32>
pub fn len(&self) -> Option<i32>
Returns the length of the contig, if it is set.
Examples
use noodles_vcf::header::Contig;
let contig = Contig::new("sq0");
assert_eq!(contig.len(), None);
sourcepub fn idx(&self) -> Option<usize>
pub fn idx(&self) -> Option<usize>
Returns the index of the ID in the dictionary of strings.
This is typically used in BCF.
Examples
use noodles_vcf::header::Contig;
let contig = Contig::new("sq0");
assert!(contig.idx().is_none());
sourcepub fn get(&self, key: &str) -> Option<&str>
pub fn get(&self, key: &str) -> Option<&str>
Returns the value of the field with the given key.
Examples
use noodles_vcf::header::{contig, record, Record, Contig};
let record = Record::new(
record::Key::Contig,
record::Value::Struct(vec![
(String::from("ID"), String::from("sq0")),
(String::from("md5"), String::from("d7eba311421bbc9d3ada44709dd61534")),
]),
);
let contig = Contig::try_from(record)?;
assert_eq!(contig.get("md5"), Some("d7eba311421bbc9d3ada44709dd61534"));
assert!(contig.get("species").is_none());
Trait Implementations
impl Eq for Contig
impl StructuralEq for Contig
impl StructuralPartialEq for Contig
Auto Trait Implementations
impl RefUnwindSafe for Contig
impl Send for Contig
impl Sync for Contig
impl Unpin for Contig
impl UnwindSafe for Contig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more