pub struct ByteClass<T: AsRef<[S]>, S: StateID>(_);
Expand description

A dense DFA that shrinks its alphabet.

Alphabet shrinking is achieved by using a set of equivalence classes instead of using all possible byte values. Any two bytes belong to the same equivalence class if and only if they can be used interchangeably anywhere in the DFA while never discriminating between a match and a non-match.

This type of DFA can result in significant space reduction with a very small match time performance penalty.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

The representation used for state identifiers in this DFA. Read more

Return the identifier of this DFA’s start state.

Returns true if and only if the given identifier corresponds to a match state. Read more

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

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

Returns true if and only if this DFA is anchored. Read more

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

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

Returns true if and only if the given bytes match this DFA. Read more

Returns the first position at which a match is found. Read more

Returns the end offset of the longest match. If no match exists, then None is returned. Read more

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

Returns the same as is_match, but starts the search at the given offset. Read more

Returns the same as shortest_match, but starts the search at the given offset. Read more

Returns the same as find, but starts the search at the given offset. Read more

Returns the same as rfind, but starts the search at the given offset. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.