Struct regex_automata::hybrid::dfa::LazyRef
source · struct LazyRef<'i, 'c> {
dfa: &'i DFA,
cache: &'c Cache,
}
Expand description
A type that groups methods that require the base NFA/DFA and read-only access to the cache.
Fields§
§dfa: &'i DFA
§cache: &'c Cache
Implementations§
source§impl<'i, 'c> LazyRef<'i, 'c>
impl<'i, 'c> LazyRef<'i, 'c>
sourcefn new(dfa: &'i DFA, cache: &'c Cache) -> LazyRef<'i, 'c>
fn new(dfa: &'i DFA, cache: &'c Cache) -> LazyRef<'i, 'c>
Creates a new ‘Lazy’ wrapper for a DFA and its corresponding cache.
sourcefn get_cached_start_id(
&self,
anchored: Anchored,
start: Start,
) -> Result<LazyStateID, StartError>
fn get_cached_start_id( &self, anchored: Anchored, start: Start, ) -> Result<LazyStateID, StartError>
Return the ID of the start state for the given configuration.
If the start state has not yet been computed, then this returns an unknown lazy state ID.
sourcefn get_cached_state(&self, sid: LazyStateID) -> &State
fn get_cached_state(&self, sid: LazyStateID) -> &State
Return the cached NFA/DFA powerset state for the given ID.
This panics if the given ID does not address a valid state.
sourcefn is_sentinel(&self, id: LazyStateID) -> bool
fn is_sentinel(&self, id: LazyStateID) -> bool
Returns true if and only if the given ID corresponds to a “sentinel” state.
A sentinel state is a state that signifies a special condition of search, and where every transition maps back to itself. See LazyStateID for more details. Note that start and match states are not sentinels since they may otherwise be real states with non-trivial transitions. The purposes of sentinel states is purely to indicate something. Their transitions are not meant to be followed.
sourcefn unknown_id(&self) -> LazyStateID
fn unknown_id(&self) -> LazyStateID
Returns the ID of the unknown state for this lazy DFA.
sourcefn dead_id(&self) -> LazyStateID
fn dead_id(&self) -> LazyStateID
Returns the ID of the dead state for this lazy DFA.
sourcefn quit_id(&self) -> LazyStateID
fn quit_id(&self) -> LazyStateID
Returns the ID of the quit state for this lazy DFA.
sourcefn is_valid(&self, id: LazyStateID) -> bool
fn is_valid(&self, id: LazyStateID) -> bool
Returns true if and only if the given ID is valid.
An ID is valid if it is both a valid index into the transition table and is a multiple of the DFA’s stride.
sourcefn state_fits_in_cache(&self, state: &State) -> bool
fn state_fits_in_cache(&self, state: &State) -> bool
Returns true if adding the state given would fit in this cache.
sourcefn state_builder_fits_in_cache(&self, state: &StateBuilderNFA) -> bool
fn state_builder_fits_in_cache(&self, state: &StateBuilderNFA) -> bool
Returns true if adding the state to be built by the given builder would fit in this cache.
sourcefn memory_usage_for_one_more_state(&self, state_heap_size: usize) -> usize
fn memory_usage_for_one_more_state(&self, state_heap_size: usize) -> usize
Returns the additional memory usage, in bytes, required to add one more state to this cache. The given size should be the heap size, in bytes, that would be used by the new state being added.