Match

Struct Match 

Source
pub struct Match<'a> {
    pub segment: u8,
    pub nav: Nav,
    pub node_type: NodeTypeIR,
    pub node_field: Option<NonZeroU16>,
    /* private fields */
}
Expand description

Match instruction decoded from bytecode.

Provides iterator-based access to effects and successors without allocating.

Fields§

§segment: u8

Segment index (0-3, currently only 0 is used).

§nav: Nav

Navigation command. Epsilon means no cursor movement or node check.

§node_type: NodeTypeIR

Node type constraint (Any = wildcard, Named/Anonymous for specific checks).

§node_field: Option<NonZeroU16>

Field constraint (None = wildcard).

Implementations§

Source§

impl<'a> Match<'a>

Source

pub fn from_bytes(bytes: &'a [u8]) -> Self

Parse a Match instruction from bytecode without allocating.

The slice must start at the instruction and contain at least the full instruction size (determined by opcode).

Header byte layout: segment(2) | node_kind(2) | opcode(4)

Source

pub fn is_terminal(&self) -> bool

Check if this is a terminal (accept) state.

Source

pub fn is_epsilon(&self) -> bool

Check if this is an epsilon transition (no node interaction).

Source

pub fn is_match8(&self) -> bool

Check if this is a Match8 (8-byte fast-path instruction).

Source

pub fn succ_count(&self) -> usize

Number of successors.

Source

pub fn successor(&self, idx: usize) -> StepId

Get a successor by index.

Source

pub fn pre_effects(&self) -> impl Iterator<Item = EffectOp> + '_

Iterate over pre-effects (executed before match attempt).

Source

pub fn neg_fields(&self) -> impl Iterator<Item = u16> + '_

Iterate over negated fields (must NOT be present on matched node).

Source

pub fn post_effects(&self) -> impl Iterator<Item = EffectOp> + '_

Iterate over post-effects (executed after successful match).

Source

pub fn successors(&self) -> impl Iterator<Item = StepId> + '_

Iterate over successors.

Source

pub fn has_predicate(&self) -> bool

Whether this instruction has a predicate (text filter).

Source

pub fn predicate(&self) -> Option<(u8, bool, u16)>

Get predicate data if present: (op, is_regex, value_ref).

  • op: operator (0=Eq, 1=Ne, 2=StartsWith, 3=EndsWith, 4=Contains, 5=RegexMatch, 6=RegexNoMatch)
  • is_regex: true if value_ref is a RegexTable index, false if StringTable index
  • value_ref: index into the appropriate table

Trait Implementations§

Source§

impl<'a> Clone for Match<'a>

Source§

fn clone(&self) -> Match<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Match<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> Copy for Match<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Match<'a>

§

impl<'a> RefUnwindSafe for Match<'a>

§

impl<'a> Send for Match<'a>

§

impl<'a> Sync for Match<'a>

§

impl<'a> Unpin for Match<'a>

§

impl<'a> UnwindSafe for Match<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.