Struct InstructionCounter
pub struct InstructionCounter { /* private fields */ }
Expand description
A counter for iteration over instruction space.
Implementations§
§impl InstructionCounter
impl InstructionCounter
pub fn set_current(&mut self, instr: &Instruction)
pub fn set_current(&mut self, instr: &Instruction)
Sets the current instruction to instr
.
pub fn range(
start: &Instruction,
end: Option<Instruction>,
) -> InstructionCounter
pub fn range( start: &Instruction, end: Option<Instruction>, ) -> InstructionCounter
Creates an instruction counter with the current position set to start
and the end at end
if it is not None
.
pub fn extend(&mut self, filters: &FilterList, fast_tunnel: bool) -> bool
pub fn extend(&mut self, filters: &FilterList, fast_tunnel: bool) -> bool
Increases the length of the current instruction by one byte. If this causes any instruction filter to match, the current instruction may advance.
pub fn reduce(&mut self, filters: &FilterList, fast_tunnel: bool) -> bool
pub fn reduce(&mut self, filters: &FilterList, fast_tunnel: bool) -> bool
Reduces the length of the current instruction by one byte. If this causes any instruction filter to match, the current instruction may advance.
pub fn apply_filters_to_current(
&mut self,
filters: &FilterList,
was_reduced_last: bool,
) -> bool
pub fn apply_filters_to_current( &mut self, filters: &FilterList, was_reduced_last: bool, ) -> bool
Applys the filters to the current instruction. The current instruction is advanced to the first (lexicographically) instruction after the current instruction, which does not match any of the filters.
pub fn tunnel_next(&mut self, filters: &FilterList, tunnel_delay: usize) -> bool
pub fn tunnel_next(&mut self, filters: &FilterList, tunnel_delay: usize) -> bool
Tunnels to the next instruction. If this causes any instruction filter to match, the current instruction may advance.
pub fn tunnel_next_ignore_filters(&mut self) -> bool
pub fn tunnel_next_ignore_filters(&mut self) -> bool
Tunnels to the next instruction, without looking at instruction filters.
pub fn current(&self) -> Instruction
pub fn current(&self) -> Instruction
The current position of the counter.
pub fn next_happy_group(&self) -> Option<Vec<Instruction>>
pub fn next_happy_group(&self) -> Option<Vec<Instruction>>
Returns the next 256 instructions, assuming we’re tunneling via the “happy path”. The happy path occurs when the instruction length does not change at all.
Returns None if the byte at the tunnel position is not 00.
pub fn tunnel_pos(&self) -> usize
pub fn tunnel_pos(&self) -> usize
The tunneling position. This is the byte index in the instruction that will be incremented next.
pub fn set_tunnel_pos(&mut self, tunnel_pos: usize)
pub fn set_tunnel_pos(&mut self, tunnel_pos: usize)
Replaces the tunneling position with the new tunnel_pos
.
pub fn set_end(&mut self, end: Option<Instruction>)
pub fn set_end(&mut self, end: Option<Instruction>)
Replaces the end of the counter with end
, or removes the end if end
is None
.
pub fn end(&self) -> Option<Instruction>
pub fn end(&self) -> Option<Instruction>
Returns the end of the counter.
Trait Implementations§
§impl Clone for InstructionCounter
impl Clone for InstructionCounter
§fn clone(&self) -> InstructionCounter
fn clone(&self) -> InstructionCounter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for InstructionCounter
impl Debug for InstructionCounter
§impl<'de> Deserialize<'de> for InstructionCounter
impl<'de> Deserialize<'de> for InstructionCounter
§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
§impl JsonSchema for InstructionCounter
impl JsonSchema for InstructionCounter
§fn schema_name() -> String
fn schema_name() -> String
§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read more§impl Serialize for InstructionCounter
impl Serialize for InstructionCounter
Auto Trait Implementations§
impl Freeze for InstructionCounter
impl RefUnwindSafe for InstructionCounter
impl Send for InstructionCounter
impl Sync for InstructionCounter
impl Unpin for InstructionCounter
impl UnwindSafe for InstructionCounter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more