Struct regex_automata::util::determinize::state::ReprVec

source ·
struct ReprVec<'a>(&'a mut Vec<u8>);
Expand description

ReprVec is a write-only view into the representation of a DFA state.

See Repr for more details on the purpose of this type and also the format.

Note that not all possible combinations of methods may be called. This is precisely what the various StateBuilder types encapsulate: they only permit valid combinations via Rust’s linear typing.

Tuple Fields§

§0: &'a mut Vec<u8>

Implementations§

source§

impl<'a> ReprVec<'a>

source

fn set_is_match(&mut self)

Set this state as a match state.

This should not be exposed explicitly outside of this module. It is set automatically when a pattern ID is added.

source

fn set_has_pattern_ids(&mut self)

Set that this state has pattern IDs explicitly written to it.

This should not be exposed explicitly outside of this module. This is used internally as a space saving optimization. Namely, if the state is a match state but does not have any pattern IDs written to it, then it is automatically inferred to have a pattern ID of ZERO.

source

fn set_is_from_word(&mut self)

Set this state as being built from a transition over a word byte.

Setting this is only necessary when one needs to deal with word boundary assertions. Therefore, if the underlying NFA has no word boundary assertions, callers should not set this.

source

fn set_is_half_crlf(&mut self)

Set this state as having seen half of a CRLF terminator.

In the forward direction, this should be set when a \r has been seen. In the reverse direction, this should be set when a \n has been seen.

source

fn look_have(&self) -> LookSet

The set of look-behind assertions that were true in the transition that created this state.

source

fn look_need(&self) -> LookSet

The set of look-around (both behind and ahead) assertions that appear at least once in this state’s set of NFA states.

source

fn set_look_have(&mut self, set: impl FnMut(LookSet) -> LookSet)

Mutate the set of look-behind assertions that were true in the transition that created this state.

source

fn set_look_need(&mut self, set: impl FnMut(LookSet) -> LookSet)

Mutate the set of look-around (both behind and ahead) assertions that appear at least once in this state’s set of NFA states.

source

fn add_match_pattern_id(&mut self, pid: PatternID)

Add a pattern ID to this state. All match states must have at least one pattern ID associated with it.

Callers must never add duplicative pattern IDs.

The order in which patterns are added must correspond to the order in which patterns are reported as matches.

source

fn close_match_pattern_ids(&mut self)

Indicate that no more pattern IDs will be added to this state.

Once this is called, callers must not call it or ‘add_match_pattern_id’ again.

This should not be exposed explicitly outside of this module. It should be called only when converting a StateBuilderMatches into a StateBuilderNFA.

source

fn add_nfa_state_id(&mut self, prev: &mut StateID, sid: StateID)

Add an NFA state ID to this state. The order in which NFA states are added matters. It is the caller’s responsibility to ensure that duplicate NFA state IDs are not added.

source

fn repr(&self) -> Repr<'_>

Return a read-only view of this state’s representation.

Auto Trait Implementations§

§

impl<'a> Freeze for ReprVec<'a>

§

impl<'a> RefUnwindSafe for ReprVec<'a>

§

impl<'a> Send for ReprVec<'a>

§

impl<'a> Sync for ReprVec<'a>

§

impl<'a> Unpin for ReprVec<'a>

§

impl<'a> !UnwindSafe for ReprVec<'a>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.