rust_htslib::bcf::buffer

Struct RecordBuffer

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

A buffer for BCF records. This allows access regions in a sorted BCF file while iterating over it in a single pass. The buffer is implemented as a ringbuffer, such that extension or movement to the right has linear complexity. The buffer does not use any indexed random access. Hence, for getting a region at the very end of the BCF, you will have to wait until all records before have been read.

Implementations§

Source§

impl RecordBuffer

Source

pub fn new(reader: Reader) -> Self

Create new buffer.

Source

pub fn fetch( &mut self, chrom: &[u8], start: u64, end: u64, ) -> Result<(usize, usize)>

Fill the buffer with variants in the given window. The start coordinate has to be right of the start coordinate of any previous fill operation. Coordinates are 0-based, and end is exclusive. Returns tuple with numbers of added and deleted records compared to previous fetch.

Source

pub fn iter(&self) -> Iter<'_, Record>

Iterate over records that have been fetched with fetch.

Source

pub fn iter_mut(&mut self) -> IterMut<'_, Record>

Iterate over mutable references to records that have been fetched with fetch.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Debug for RecordBuffer

Source§

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

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

impl Send for RecordBuffer

Source§

impl Sync for RecordBuffer

Auto Trait Implementations§

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

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

Source§

impl<T> MaybeSendSync for T