pub struct VCDReader<R> {
pub header: Header,
/* private fields */
}
Expand description
A reader for VCDIFF patches.
Fields§
§header: Header
Implementations§
Source§impl<R: Read + Seek> VCDReader<R>
impl<R: Read + Seek> VCDReader<R>
Sourcepub fn new(source: R) -> Result<Self>
pub fn new(source: R) -> Result<Self>
Creates a new VCDReader from a source that implements the Read
trait.
This function attempts to read and parse the VCDIFF header to ensure the stream is valid.
If the stream does not start with the expected VCDIFF magic number or the header is invalid,
an error is returned.
Sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Consumes the reader and returns the inner reader.
Sourcepub fn seek_to_window(&mut self, win_start_pos: u64)
pub fn seek_to_window(&mut self, win_start_pos: u64)
Seeks to the start of the window at the given position. This is useful when you want to seek to a specific window in the patch. It allows you to ‘rewind’. If needed. This does not verify that the position is a valid window start.
§Arguments
win_start_pos
- The byte offset from the start of the patch file where the window starts.
Sourcepub fn read_from_src(&mut self, from_start: u64, buf: &mut [u8]) -> Result<()>
pub fn read_from_src(&mut self, from_start: u64, buf: &mut [u8]) -> Result<()>
Allows inner access to the reader in a controlled manner that will not mess up the reader’s state. This is useful when you need to read from the patch file directly.
§Arguments
from_start
- The byte offset from the start of the patch file where to start reading.buf
- The buffer to read_exact into.
Sourcepub fn get_reader(&mut self, at_from_start: u64) -> Result<&mut R>
pub fn get_reader(&mut self, at_from_start: u64) -> Result<&mut R>
Allows inner access to the reader in a controlled manner that will not mess up the reader’s state. This is useful when you need to read from the patch file directly.
§Arguments
at_from_start
- The byte offset from the start of the patch file for where to seek to.
Sourcepub fn next(&mut self) -> Result<VCDiffReadMsg>
pub fn next(&mut self) -> Result<VCDiffReadMsg>
Reads the next segment from the VCDIFF patch, returning it as a VCDiffMessage
.