Header

Struct Header 

Source
pub struct Header { /* private fields */ }
Expand description

Thin wrapper around htsvcf_core::Header for use in V8.

This delegates all VCF header logic to the core Header and adds only V8-specific functionality (GC integration, JS bindings).

Implementations§

Source§

impl Header

Source

pub unsafe fn new(ptr: *mut bcf_hdr_t) -> Self

Create a Header from a raw bcf_hdr_t pointer.

§Safety

The pointer must be valid. The core Header will duplicate and own the memory.

Source

pub fn header_records(&self) -> Vec<HeaderRecord>

Return parsed header records.

Source

pub fn info_type(&self, tag: &[u8]) -> Option<(TagType, TagLength)>

Get INFO tag type/length from the header.

Source

pub fn format_type(&self, tag: &[u8]) -> Option<(TagType, TagLength)>

Get FORMAT tag type/length from the header.

Source

pub fn sample_id(&self, sample: &[u8]) -> Option<usize>

Get sample ID (index) from sample name.

Source

pub fn id_to_name(&self, id: u32) -> Vec<u8>

Get tag name from numeric ID.

Source

pub fn id_to_name_cached(&self, id: u32) -> (String, Vec<u8>)

Get the cached name for a tag ID, returning both the String and bytes.

Source

pub fn sample_count(&self) -> usize

Get the number of samples in the header.

Source

pub fn sample_names(&self) -> &[String]

Get all sample names as strings.

Source

pub fn sample_idx(&self, name: &str) -> Option<usize>

Get the index of a sample by name, or None if not found.

Source

pub fn sample_name_to_idx(&self) -> &HashMap<String, usize>

Get a reference to the sample name-to-index map.

Source

pub fn push_record(&self, record: &[u8]) -> bool

Append a raw header line (e.g. ##INFO=...).

Source

pub fn add_info( &self, id: &str, number: &str, ty: &str, description: &str, ) -> bool

Add an ##INFO header line.

Source

pub fn add_format( &self, id: &str, number: &str, ty: &str, description: &str, ) -> bool

Add a ##FORMAT header line.

Source

pub fn to_string(&self) -> Option<String>

Format header as string.

Source

pub fn inner(&self) -> &Header

Get a reference to the inner core Header.

Trait Implementations§

Source§

impl Debug for Header

Source§

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

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

impl GarbageCollected for Header

Source§

fn trace(&self, _visitor: &mut Visitor)

No-op trace because Header does not reference other GC objects.

Source§

fn get_name(&self) -> &'static CStr

Class name shown in V8 heap snapshots.

Auto Trait Implementations§

§

impl !Freeze for Header

§

impl RefUnwindSafe for Header

§

impl Send for Header

§

impl Sync for Header

§

impl Unpin for Header

§

impl UnwindSafe for Header

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> 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, 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.
§

impl<T> ErasedDestructor for T
where T: 'static,