pub struct VhdReader { /* private fields */ }Expand description
Read-only VHD container reader.
Implements Read + Seek over the virtual sector stream.
Implementations§
Source§impl VhdReader
impl VhdReader
Sourcepub fn open(path: &Path) -> Result<Self, VhdError>
pub fn open(path: &Path) -> Result<Self, VhdError>
Open a VHD disk image.
Returns VhdError if the file is not a valid VHD, or if it is a
Differencing disk (parent resolution is not supported).
Sourcepub fn open_reader(backing: Box<dyn ReadSeekSend>) -> Result<Self, VhdError>
pub fn open_reader(backing: Box<dyn ReadSeekSend>) -> Result<Self, VhdError>
Open a VHD image from any seekable byte source (a Cursor over inflated
bytes, a positioned sub-range of a .zip, …) rather than a file path —
so an image stored inside an archive can be read without extracting it to
a temp file first.
Sourcepub fn virtual_disk_size(&self) -> u64
pub fn virtual_disk_size(&self) -> u64
Virtual disk size in bytes — the current, readable capacity (footer CurrentSize, offset 48). This is what qemu-img reports.
Sourcepub fn original_size(&self) -> u64
pub fn original_size(&self) -> u64
Original (creation-time) size in bytes (footer OriginalSize, offset 40).
Equals virtual_disk_size for an un-resized disk and differs after a
resize (a forensic signal). This is the value libvhdi reports as media size.
Trait Implementations§
Source§impl Read for VhdReader
impl Read for VhdReader
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 VhdReader
impl Seek for VhdReader
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)