Struct VCDReader

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

Source

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.

Source

pub fn into_inner(self) -> R

Consumes the reader and returns the inner reader.

Source

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

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

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

pub fn next(&mut self) -> Result<VCDiffReadMsg>

Reads the next segment from the VCDIFF patch, returning it as a VCDiffMessage.

Trait Implementations§

Source§

impl<R: Debug> Debug for VCDReader<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> Freeze for VCDReader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for VCDReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for VCDReader<R>
where R: Send,

§

impl<R> Sync for VCDReader<R>
where R: Sync,

§

impl<R> Unpin for VCDReader<R>
where R: Unpin,

§

impl<R> UnwindSafe for VCDReader<R>
where R: 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.