[][src]Struct regex_automata::sparse::ByteClass

pub struct ByteClass<T: AsRef<[u8]>, S: StateID = usize>(_);

A sparse 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.

Unlike dense DFAs, sparse DFAs do not tend to benefit nearly as much from using byte classes. In some cases, using byte classes can even marginally increase the size of a sparse DFA's transition table. The reason for this is that a sparse DFA already compacts each state's transitions separate from whether byte classes are used.

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

impl<T: AsRef<[u8]>, S: StateID> DFA for ByteClass<T, S>[src]

type ID = S

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

fn is_match(&self, bytes: &[u8]) -> bool[src]

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

fn shortest_match(&self, bytes: &[u8]) -> Option<usize>[src]

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

fn find(&self, bytes: &[u8]) -> Option<usize>[src]

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

fn rfind(&self, bytes: &[u8]) -> Option<usize>[src]

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

fn is_match_at(&self, bytes: &[u8], start: usize) -> bool[src]

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

fn shortest_match_at(&self, bytes: &[u8], start: usize) -> Option<usize>[src]

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

fn find_at(&self, bytes: &[u8], start: usize) -> Option<usize>[src]

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

fn rfind_at(&self, bytes: &[u8], start: usize) -> Option<usize>[src]

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

impl<T: Clone + AsRef<[u8]>, S: Clone + StateID> Clone for ByteClass<T, S>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Debug + AsRef<[u8]>, S: Debug + StateID> Debug for ByteClass<T, S>[src]

Auto Trait Implementations

impl<T, S> Send for ByteClass<T, S> where
    S: Send,
    T: Send

impl<T, S> Sync for ByteClass<T, S> where
    S: Sync,
    T: Sync

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]