pub struct ImageCursor { /* private fields */ }Expand description
Seekable cursor over an Image logical media stream.
Implementations§
Source§impl ImageCursor
impl ImageCursor
Sourcepub fn offset(&self) -> u64
pub fn offset(&self) -> u64
Alias for ImageCursor::position.
Sourcepub fn read_buffer(&mut self, buf: &mut [u8]) -> Result<usize>
pub fn read_buffer(&mut self, buf: &mut [u8]) -> Result<usize>
Reads logical media bytes at the current cursor position and advances.
§Errors
Returns an error if the underlying Image::read_at call fails or the
cursor position would overflow.
Sourcepub fn read_buffer_at_offset(
&mut self,
buf: &mut [u8],
offset: u64,
) -> Result<usize>
pub fn read_buffer_at_offset( &mut self, buf: &mut [u8], offset: u64, ) -> Result<usize>
Seeks to offset, reads into buf, and advances by the bytes read.
§Errors
Returns the same errors as ImageCursor::read_buffer.
Sourcepub fn seek_offset(&mut self, pos: SeekFrom) -> Result<u64>
pub fn seek_offset(&mut self, pos: SeekFrom) -> Result<u64>
Sourcepub fn segment_filename(&self) -> Result<Option<&Path>>
pub fn segment_filename(&self) -> Result<Option<&Path>>
Returns the segment containing the current cursor position.
Positions at or beyond the logical media size return Ok(None).
§Errors
Returns an error if the image chunk geometry is malformed.
Sourcepub fn read_data_chunk(&mut self) -> Result<Option<DataChunk>>
pub fn read_data_chunk(&mut self) -> Result<Option<DataChunk>>
Reads the data chunk at the current cursor position and advances to the next chunk.
Returns Ok(None) when the cursor is at or beyond the logical media end.
§Errors
Returns an error if reading the chunk fails or the cursor position would overflow.
Sourcepub fn read_encoded_data_chunk(&mut self) -> Result<Option<EncodedDataChunk>>
pub fn read_encoded_data_chunk(&mut self) -> Result<Option<EncodedDataChunk>>
Reads the encoded data chunk at the current cursor position and advances.
Returns Ok(None) when the cursor is at or beyond the logical media end.
§Errors
Returns an error if reading the chunk fails or the cursor position would overflow.
Trait Implementations§
Source§impl Clone for ImageCursor
impl Clone for ImageCursor
Source§impl Debug for ImageCursor
impl Debug for ImageCursor
Source§impl Read for ImageCursor
impl Read for ImageCursor
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_, u8>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_, u8>) -> Result<(), Error>
read_buf)Source§fn read_buf_exact(
&mut self,
cursor: BorrowedCursor<'_, u8>,
) -> Result<(), Error>
fn read_buf_exact( &mut self, cursor: BorrowedCursor<'_, u8>, ) -> Result<(), Error>
read_buf)cursor. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read. Read more1.0.0 · Source§fn chain<R>(self, next: R) -> Chain<Self, R>
fn chain<R>(self, next: R) -> Chain<Self, R>
1.0.0 · Source§fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
limit bytes from it. Read moreSource§fn read_array<const N: usize>(&mut self) -> Result<[u8; N], Error>where
Self: Sized,
fn read_array<const N: usize>(&mut self) -> Result<[u8; N], Error>where
Self: Sized,
read_array)Source§impl Seek for ImageCursor
impl Seek for ImageCursor
Source§fn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
1.55.0 · Source§fn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
Source§fn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
seek_stream_len)