twitcher 0.7.0

Find template switch mutations in genomic data
use std::ops::{Deref, DerefMut};

use rust_htslib::bcf;

/// A record bound to the output file's header, and therefore writable.
///
/// The output header is the one this program builds itself (see `augment_header`), so every
/// tag it declares can be pushed onto such a record. Instances come from the writer only —
/// either freshly created for a synthesized record, or adopted from an
/// [`InputRecord`](crate::vcf::pipeline::record::InputRecord), which rebinds it to the output
/// header. That restriction is what makes the mutable access below sound: a record still
/// bound to the input header can never reach it.
#[derive(Debug, Clone)]
pub struct OutputRecord(bcf::Record);

impl OutputRecord {
    /// Only the writer may declare a record to be bound to the output header.
    pub(super) const fn new(record: bcf::Record) -> Self {
        Self(record)
    }
}

impl Deref for OutputRecord {
    type Target = bcf::Record;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

impl DerefMut for OutputRecord {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}