Skip to main content

LeCursor

Struct LeCursor 

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

Source

pub fn new(buf: &'a [u8], base: u64, path: &'a str) -> Self

Source

pub fn position(&self) -> usize

Source

pub fn file_offset(&self) -> u64

Source

pub fn remaining(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn seek(&mut self, pos: usize) -> Result<()>

Source

pub fn skip(&mut self, n: usize) -> Result<()>

Source

pub fn take(&mut self, n: usize) -> Result<&'a [u8]>

Source

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.

Source

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<'_>

Source

pub fn read_u8(&mut self) -> Result<u8>

Source

pub fn peek_u8(&self) -> Result<u8>

Source

pub fn read_i8(&mut self) -> Result<i8>

Source

pub fn peek_i8(&self) -> Result<i8>

Source

pub fn read_u16(&mut self) -> Result<u16>

Source

pub fn peek_u16(&self) -> Result<u16>

Source

pub fn read_i16(&mut self) -> Result<i16>

Source

pub fn peek_i16(&self) -> Result<i16>

Source

pub fn read_u32(&mut self) -> Result<u32>

Source

pub fn peek_u32(&self) -> Result<u32>

Source

pub fn read_i32(&mut self) -> Result<i32>

Source

pub fn peek_i32(&self) -> Result<i32>

Source

pub fn read_u64(&mut self) -> Result<u64>

Source

pub fn peek_u64(&self) -> Result<u64>

Source

pub fn read_i64(&mut self) -> Result<i64>

Source

pub fn peek_i64(&self) -> Result<i64>

Source

pub fn read_f32(&mut self) -> Result<f32>

Source

pub fn peek_f32(&self) -> Result<f32>

Source

pub fn read_f64(&mut self) -> Result<f64>

Source

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> 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> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.