pub struct LeCursor<'a> { /* private fields */ }Expand description
A forward cursor over a buffer, reading little-endian fields.
Carries the path it came from so that a short read names the file rather than reporting a bare offset the caller has to attribute.
Implementations§
Source§impl<'a> LeCursor<'a>
impl<'a> LeCursor<'a>
pub fn new(buf: &'a [u8], base: u64, path: &'a str) -> Self
pub fn position(&self) -> usize
pub fn file_offset(&self) -> u64
pub fn remaining(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn seek(&mut self, pos: usize) -> Result<()>
pub fn skip(&mut self, n: usize) -> Result<()>
pub fn take(&mut self, n: usize) -> Result<&'a [u8]>
Sourcepub fn take_cstr(&mut self) -> Result<&'a str>
pub fn take_cstr(&mut self) -> Result<&'a str>
A NUL-terminated string, cursor left after the NUL. BAM read names and SAM header text are stored this way.
Sourcepub fn take_padded_str(&mut self, width: usize) -> Result<&'a str>
pub fn take_padded_str(&mut self, width: usize) -> Result<&'a str>
A fixed-width, NUL-padded string, as the bbi chromosome B+ tree stores its keys. The whole field is consumed whatever the string’s length.
Source§impl LeCursor<'_>
impl LeCursor<'_>
pub fn read_u8(&mut self) -> Result<u8>
pub fn peek_u8(&self) -> Result<u8>
pub fn read_i8(&mut self) -> Result<i8>
pub fn peek_i8(&self) -> Result<i8>
pub fn read_u16(&mut self) -> Result<u16>
pub fn peek_u16(&self) -> Result<u16>
pub fn read_i16(&mut self) -> Result<i16>
pub fn peek_i16(&self) -> Result<i16>
pub fn read_u32(&mut self) -> Result<u32>
pub fn peek_u32(&self) -> Result<u32>
pub fn read_i32(&mut self) -> Result<i32>
pub fn peek_i32(&self) -> Result<i32>
pub fn read_u64(&mut self) -> Result<u64>
pub fn peek_u64(&self) -> Result<u64>
pub fn read_i64(&mut self) -> Result<i64>
pub fn peek_i64(&self) -> Result<i64>
pub fn read_f32(&mut self) -> Result<f32>
pub fn peek_f32(&self) -> Result<f32>
pub fn read_f64(&mut self) -> Result<f64>
pub fn peek_f64(&self) -> Result<f64>
Auto Trait Implementations§
impl<'a> Freeze for LeCursor<'a>
impl<'a> RefUnwindSafe for LeCursor<'a>
impl<'a> Send for LeCursor<'a>
impl<'a> Sync for LeCursor<'a>
impl<'a> Unpin for LeCursor<'a>
impl<'a> UnsafeUnpin for LeCursor<'a>
impl<'a> UnwindSafe for LeCursor<'a>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more