pub struct GziIndex {
pub entries: Vec<(u64, u64)>,
}Expand description
A gzip index for BGZF-compressed files.
Maps uncompressed byte positions to compressed file positions, enabling efficient seeking in compressed files.
§Format
Binary format (little-endian):
- First 8 bytes: number of index entries (u64)
- Following bytes: pairs of (compressed_offset, uncompressed_offset) as u64
§Example
use fastx::gzi::GziIndex;
use std::path::Path;
let index = GziIndex::from_path(Path::new("data.fasta.gz.gzi")).unwrap();
let compressed_offset = index.get_compressed_offset(10000).unwrap();Fields§
§entries: Vec<(u64, u64)>Sorted entries: (compressed_offset, uncompressed_offset)
Implementations§
Source§impl GziIndex
impl GziIndex
Sourcepub fn from_bytes(buffer: &[u8]) -> Result<Self>
pub fn from_bytes(buffer: &[u8]) -> Result<Self>
Sourcepub fn get_compressed_offset(&self, uncompressed_offset: u64) -> Option<u64>
pub fn get_compressed_offset(&self, uncompressed_offset: u64) -> Option<u64>
Get the compressed offset for a given uncompressed position.
Sourcepub fn get_uncompressed_offset(&self, compressed_offset: u64) -> Option<u64>
pub fn get_uncompressed_offset(&self, compressed_offset: u64) -> Option<u64>
Get the uncompressed offset for a given compressed position.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GziIndex
impl RefUnwindSafe for GziIndex
impl Send for GziIndex
impl Sync for GziIndex
impl Unpin for GziIndex
impl UnwindSafe for GziIndex
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