Struct regex_automata::util::start::StartByteMap

source ·
pub(crate) struct StartByteMap {
    map: [Start; 256],
}
Expand description

A map from every possible byte value to its corresponding starting configuration.

This map is used in order to lookup the start configuration for a particular position in a haystack. This start configuration is then used in combination with things like the anchored mode and pattern ID to fully determine the start state.

Generally speaking, this map is only used for fully compiled DFAs and lazy DFAs. For NFAs (including the one-pass DFA), the start state is generally selected by virtue of traversing the NFA state graph. DFAs do the same thing, but at build time and not search time. (Well, technically the lazy DFA does it at search time, but it does enough work to cache the full result of the epsilon closure that the NFA engines tend to need to do.)

Fields§

§map: [Start; 256]

Implementations§

source§

impl StartByteMap

source

pub(crate) fn new(lookm: &LookMatcher) -> StartByteMap

Create a new map from byte values to their corresponding starting configurations. The map is determined, in part, by how look-around assertions are matched via the matcher given.

source

pub(crate) fn get(&self, byte: u8) -> Start

Return the starting configuration for the given look-behind byte.

If no look-behind exists, callers should use Start::Text.

source

pub(crate) fn from_bytes( slice: &[u8], ) -> Result<(StartByteMap, usize), DeserializeError>

Deserializes a byte class map from the given slice. If the slice is of insufficient length or otherwise contains an impossible mapping, then an error is returned. Upon success, the number of bytes read along with the map are returned. The number of bytes read is always a multiple of 8.

source

pub(crate) fn write_to(&self, dst: &mut [u8]) -> Result<usize, SerializeError>

Writes this map to the given byte buffer. if the given buffer is too small, then an error is returned. Upon success, the total number of bytes written is returned. The number of bytes written is guaranteed to be a multiple of 8.

source

pub(crate) fn write_to_len(&self) -> usize

Returns the total number of bytes written by write_to.

Trait Implementations§

source§

impl Clone for StartByteMap

source§

fn clone(&self) -> StartByteMap

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for StartByteMap

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.