pub struct Index(/* private fields */);
Expand description
A gzip index (GZI).
A gzip index holds compressed-uncompressed position pairs.
Like this physical index, this does not include the position of the first block, which is implicity at 0.
Implementations§
Source§impl Index
impl Index
Sourcepub fn query(&self, pos: u64) -> Result<VirtualPosition>
pub fn query(&self, pos: u64) -> Result<VirtualPosition>
Returns the virtual position at the given uncompressed position.
§Examples
use noodles_bgzf::{self as bgzf, gzi};
let index = gzi::Index::default();
assert_eq!(index.query(0)?, bgzf::VirtualPosition::default());
let index = gzi::Index::from(vec![(8, 21), (13, 55)]);
assert_eq!(index.query(0)?, bgzf::VirtualPosition::default());
assert_eq!(index.query(13)?, bgzf::VirtualPosition::try_from((0, 13))?);
assert_eq!(index.query(34)?, bgzf::VirtualPosition::try_from((8, 13))?);
assert_eq!(index.query(89)?, bgzf::VirtualPosition::try_from((13, 34))?);
Ok::<_, Box<dyn std::error::Error>>(())
Trait Implementations§
impl Eq for Index
impl StructuralPartialEq for Index
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnwindSafe for Index
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more