Enum aho_corasick::nfa::contiguous::StateTrans
source · enum StateTrans<'a> {
Sparse {
classes: &'a [u32],
nexts: &'a [u32],
},
One {
class: u8,
next: u32,
},
Dense {
class_to_next: &'a [u32],
},
}
Expand description
The underlying representation of sparse or dense transitions for a state.
Note that like State
, we don’t typically construct values of this type
during a search since we don’t always need all values and thus would
represent a lot of wasteful work.
Variants§
Sparse
A sparse representation of transitions for a state, where only non-FAIL transitions are explicitly represented.
Fields
One
A “one transition” state that is never a match state.
These are by far the most common state, so we use a specialized and very compact representation for them.
Fields
Dense
A dense representation of transitions for a state, where all transitions are explicitly represented, including transitions to the FAIL state.
Fields
class_to_next: &'a [u32]
A dense set of transitions to other states. The transitions may point to a FAIL state, in which case, the search should try the same transition lookup at ‘fail’.
Note that this is indexed by byte equivalence classes and not byte values. That means ‘class_to_next[byte]’ is wrong and ‘class_to_next[classes.get(byte)]’ is correct. The number of transitions is always equivalent to ‘classes.alphabet_len()’.
Trait Implementations§
source§impl<'a> Clone for StateTrans<'a>
impl<'a> Clone for StateTrans<'a>
source§fn clone(&self) -> StateTrans<'a>
fn clone(&self) -> StateTrans<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more