morpheus_core::iso

Struct ChunkedReader

Source
pub struct ChunkedReader<F>
where F: FnMut(u64, &mut [u8]) -> Result<(), IsoError>,
{ block_io: ChunkedBlockIo<F>, position: u64, sector_buf: [u8; 512], }
Expand description

Simpler read interface for when you just need byte-level access

Fields§

§block_io: ChunkedBlockIo<F>§position: u64

Current position

§sector_buf: [u8; 512]

Sector buffer for unaligned reads

Implementations§

Source§

impl<F> ChunkedReader<F>
where F: FnMut(u64, &mut [u8]) -> Result<(), IsoError>,

Source

pub fn new(ctx: IsoReadContext, read_fn: F) -> Self

Create a new chunked reader

Source

pub fn total_size(&self) -> u64

Get total size

Source

pub fn position(&self) -> u64

Get current position

Source

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

Seek to position

Source

pub fn read(&mut self, buffer: &mut [u8]) -> Result<usize, IsoError>

Read bytes at current position

Source

pub fn read_exact(&mut self, buffer: &mut [u8]) -> Result<(), IsoError>

Read exact number of bytes (error if not available)

Auto Trait Implementations§

§

impl<F> Freeze for ChunkedReader<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for ChunkedReader<F>
where F: RefUnwindSafe,

§

impl<F> Send for ChunkedReader<F>
where F: Send,

§

impl<F> Sync for ChunkedReader<F>
where F: Sync,

§

impl<F> Unpin for ChunkedReader<F>
where F: Unpin,

§

impl<F> UnwindSafe for ChunkedReader<F>
where F: UnwindSafe,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.