rust_htslib::tbx

Trait Read

Source
pub trait Read: Sized {
    // Required methods
    fn read(&mut self, record: &mut Vec<u8>) -> Result<bool>;
    fn records(&mut self) -> Records<'_, Self> ;
    fn header(&self) -> &Vec<String>;
}
Expand description

A trait for a Tabix reader with a read method.

Required Methods§

Source

fn read(&mut self, record: &mut Vec<u8>) -> Result<bool>

Read next line into the given Vec<u8> (i.e., ASCII string).

Use this method in combination with a single allocated record to avoid the reallocations occurring with the iterator.

§Arguments
  • record - the Vec<u8> to be filled
§Returns

Ok(true) if record was read, Ok(false) if no more record in file

Source

fn records(&mut self) -> Records<'_, Self>

Iterator over the lines/records of the seeked region.

Note that, while being convenient, this is less efficient than pre-allocating a Vec<u8> and reading into it with the read() method, since every iteration involves the allocation of a new Vec<u8>.

Source

fn header(&self) -> &Vec<String>

Return the text headers, split by line.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§