Struct regex_automata::dense::Premultiplied
source · [−]Expand description
A dense DFA that premultiplies all of its state identifiers in its transition table.
This saves an instruction per byte at match time which improves search performance.
The only downside of premultiplication is that it may prevent one from using a smaller state identifier representation than you otherwise could.
Generally, it isn’t necessary to use this type directly, since a DenseDFA
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
sourceimpl<T: Clone + AsRef<[S]>, S: Clone + StateID> Clone for Premultiplied<T, S>
impl<T: Clone + AsRef<[S]>, S: Clone + StateID> Clone for Premultiplied<T, S>
sourcefn clone(&self) -> Premultiplied<T, S>
fn clone(&self) -> Premultiplied<T, S>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T: AsRef<[S]>, S: StateID> DFA for Premultiplied<T, S>
impl<T: AsRef<[S]>, S: StateID> DFA for Premultiplied<T, S>
sourcefn start_state(&self) -> S
fn start_state(&self) -> S
Return the identifier of this DFA’s start state.
sourcefn 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. Read more
sourcefn 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. Read more
sourcefn 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 more
sourcefn is_anchored(&self) -> bool
fn is_anchored(&self) -> bool
Returns true if and only if this DFA is anchored. Read more
sourcefn 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. Read more
sourceunsafe 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. Read more
sourcefn 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
sourcefn 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
sourcefn 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 more
sourcefn 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 more
sourcefn 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 more
sourcefn 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 more
Auto Trait Implementations
impl<T, S> RefUnwindSafe for Premultiplied<T, S> where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for Premultiplied<T, S> where
S: Send,
T: Send,
impl<T, S> Sync for Premultiplied<T, S> where
S: Sync,
T: Sync,
impl<T, S> Unpin for Premultiplied<T, S> where
S: Unpin,
T: Unpin,
impl<T, S> UnwindSafe for Premultiplied<T, S> where
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more