From 7dfd82fdc56005833bfc01d183b4d00df258ceb4 Mon Sep 17 00:00:00 2001 From: Michael Macias Date: Tue, 29 Aug 2023 11:47:42 -0500 Subject: [PATCH] bgzf/multithreaded_reader: Add virtual position getter --- noodles-bgzf/src/multithreaded_reader.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/noodles-bgzf/src/multithreaded_reader.rs b/noodles-bgzf/src/multithreaded_reader.rs index dc72eba16..293b2f51a 100644 --- a/noodles-bgzf/src/multithreaded_reader.rs +++ b/noodles-bgzf/src/multithreaded_reader.rs @@ -7,7 +7,7 @@ use std::{ use crossbeam_channel::{Receiver, Sender}; -use crate::Block; +use crate::{Block, VirtualPosition}; type BufferedTx = Sender>; type BufferedRx = Receiver>; @@ -71,6 +71,11 @@ impl MultithreadedReader { self.position } + /// Returns the current virtual position of the stream. + pub fn virtual_position(&self) -> VirtualPosition { + self.buffer.block.virtual_position() + } + /// Shuts down the reader and inflate workers. pub fn finish(&mut self) -> io::Result<()> { self.recycle_tx.take();