Skip to main content

RarVM

Struct RarVM 

Source
pub struct RarVM { /* private fields */ }
Expand description

RAR VM state

Implementations§

Source§

impl RarVM

Source

pub fn new() -> Self

Source

pub fn reset(&mut self)

Reset VM state

Source

pub fn add_code( &mut self, first_byte: u8, code: &[u8], total_written: u64, window_mask: u32, ) -> bool

Add VM code and create filter total_written is the absolute total bytes written so far (not wrapped) window_mask is used to wrap block_start for window access

Source

pub fn has_pending_filters(&self) -> bool

Check if there are pending filters

Source

pub fn find_ready_filter(&self, total_written: u64) -> Option<(usize, u64)>

Find the earliest filter that is ready to execute (block_end <= total_written) Returns the index and block_start of the earliest ready filter

Source

pub fn next_filter_pos(&self) -> Option<u64>

Get the next filter’s block start position

Source

pub fn next_filter_end(&self) -> Option<u64>

Get the earliest filter end position (block_start + block_length)

Source

pub fn peek_filter(&self) -> Option<&PreparedFilter>

Peek at the next filter without removing it

Source

pub fn execute_filter_at_index( &mut self, filter_idx: usize, window: &[u8], window_mask: usize, total_written: u64, ) -> Option<(u64, &[u8])>

Execute pending filters on the sliding window buffer. total_written is the absolute total bytes written so far. window is the circular sliding window (read-only!). window_mask is used for wrapping. Returns (filter_end_position, filtered_data) if a filter was executed. The filtered data should be written directly to output, NOT back to window.

Source

pub fn execute_filters( &mut self, buffer: &mut [u8], _write_pos: u64, ) -> Option<(usize, usize)>

Execute pending filters on the output buffer write_pos is the absolute total bytes written so far The buffer is the full output buffer, not the sliding window

Trait Implementations§

Source§

impl Default for RarVM

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for RarVM

§

impl RefUnwindSafe for RarVM

§

impl Send for RarVM

§

impl Sync for RarVM

§

impl Unpin for RarVM

§

impl UnsafeUnpin for RarVM

§

impl UnwindSafe for RarVM

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> Same for T

Source§

type Output = T

Should always be Self
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.