pub struct RarVM { /* private fields */ }Expand description
RAR VM state
Implementations§
Source§impl RarVM
impl RarVM
pub fn new() -> Self
Sourcepub fn add_code(
&mut self,
first_byte: u8,
code: &[u8],
total_written: u64,
window_mask: u32,
) -> bool
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
Sourcepub fn has_pending_filters(&self) -> bool
pub fn has_pending_filters(&self) -> bool
Check if there are pending filters
Sourcepub fn find_ready_filter(&self, total_written: u64) -> Option<(usize, u64)>
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
Sourcepub fn next_filter_pos(&self) -> Option<u64>
pub fn next_filter_pos(&self) -> Option<u64>
Get the next filter’s block start position
Sourcepub fn next_filter_end(&self) -> Option<u64>
pub fn next_filter_end(&self) -> Option<u64>
Get the earliest filter end position (block_start + block_length)
Sourcepub fn peek_filter(&self) -> Option<&PreparedFilter>
pub fn peek_filter(&self) -> Option<&PreparedFilter>
Peek at the next filter without removing it
Sourcepub fn execute_filter_at_index(
&mut self,
filter_idx: usize,
window: &[u8],
window_mask: usize,
total_written: u64,
) -> Option<(u64, &[u8])>
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.