Struct regex_automata::sparse::Standard
source · pub struct Standard<T: AsRef<[u8]>, S: StateID = usize>(/* private fields */);
Expand description
A standard sparse DFA that does not use premultiplication or byte classes.
Generally, it isn’t necessary to use this type directly, since a
SparseDFA
can be used for searching directly. One possible reason why
one might want to use this type directly is if you are implementing your
own search routines by walking a DFA’s transitions directly. In that case,
you’ll want to use this type (or any of the other DFA variant types)
directly, since they implement next_state
more efficiently.
Trait Implementations§
source§impl<T: AsRef<[u8]>, S: StateID> DFA for Standard<T, S>
impl<T: AsRef<[u8]>, S: StateID> DFA for Standard<T, S>
source§fn start_state(&self) -> S
fn start_state(&self) -> S
Return the identifier of this DFA’s start state.
source§fn is_match_state(&self, id: S) -> bool
fn is_match_state(&self, id: S) -> bool
Returns true if and only if the given identifier corresponds to a match
state.
source§fn is_dead_state(&self, id: S) -> bool
fn is_dead_state(&self, id: S) -> bool
Returns true if and only if the given identifier corresponds to a dead
state. When a DFA enters a dead state, it is impossible to leave and
thus can never lead to a match.
source§fn is_match_or_dead_state(&self, id: S) -> bool
fn is_match_or_dead_state(&self, id: S) -> bool
Returns true if and only if the given identifier corresponds to either
a dead state or a match state, such that one of
is_match_state(id)
or is_dead_state(id)
must return true. Read moresource§fn is_anchored(&self) -> bool
fn is_anchored(&self) -> bool
Returns true if and only if this DFA is anchored. Read more
source§fn next_state(&self, current: S, input: u8) -> S
fn next_state(&self, current: S, input: u8) -> S
Given the current state that this DFA is in and the next input byte,
this method returns the identifier of the next state. The identifier
returned is always valid, but it may correspond to a dead state.
source§unsafe fn next_state_unchecked(&self, current: S, input: u8) -> S
unsafe fn next_state_unchecked(&self, current: S, input: u8) -> S
Like
next_state
, but its implementation may look up the next state
without memory safety checks such as bounds checks. As such, callers
must ensure that the given identifier corresponds to a valid DFA
state. Implementors must, in turn, ensure that this routine is safe
for all valid state identifiers and for all possible u8
values.source§fn is_match(&self, bytes: &[u8]) -> bool
fn is_match(&self, bytes: &[u8]) -> bool
Returns true if and only if the given bytes match this DFA. Read more
source§fn shortest_match(&self, bytes: &[u8]) -> Option<usize>
fn shortest_match(&self, bytes: &[u8]) -> Option<usize>
Returns the first position at which a match is found. Read more
source§fn find(&self, bytes: &[u8]) -> Option<usize>
fn find(&self, bytes: &[u8]) -> Option<usize>
Returns the end offset of the longest match. If no match exists,
then
None
is returned. Read moresource§fn rfind(&self, bytes: &[u8]) -> Option<usize>
fn rfind(&self, bytes: &[u8]) -> Option<usize>
Returns the start offset of the longest match in reverse, by searching
from the end of the input towards the start of the input. If no match
exists, then
None
is returned. In other words, this has the same
match semantics as find
, but in reverse. Read moresource§fn is_match_at(&self, bytes: &[u8], start: usize) -> bool
fn is_match_at(&self, bytes: &[u8], start: usize) -> bool
Returns the same as
is_match
, but starts the search at the given
offset. Read moresource§fn shortest_match_at(&self, bytes: &[u8], start: usize) -> Option<usize>
fn shortest_match_at(&self, bytes: &[u8], start: usize) -> Option<usize>
Returns the same as
shortest_match
, but starts the search at the
given offset. Read moreAuto Trait Implementations§
impl<T, S> Freeze for Standard<T, S>
impl<T, S> RefUnwindSafe for Standard<T, S>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for Standard<T, S>
impl<T, S> Sync for Standard<T, S>
impl<T, S> Unpin for Standard<T, S>
impl<T, S> UnwindSafe for Standard<T, S>where
S: UnwindSafe,
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)