Enum regex_automata::hybrid::dfa::StateSaver

source ·
enum StateSaver {
    None,
    ToSave {
        id: LazyStateID,
        state: State,
    },
    Saved(LazyStateID),
}
Expand description

A simple type that encapsulates the saving of a state ID through a cache clearing.

A state ID can be marked for saving with ToSave, while a state ID can be saved itself with Saved.

Variants§

§

None

An empty state saver. In this case, no states (other than the special sentinel states) are preserved after clearing the cache.

§

ToSave

An ID of a state (and the state itself) that should be preserved after the lazy DFA’s cache has been cleared. After clearing, the updated ID is stored in ‘Saved’ since it may have changed.

Fields

§state: State
§

Saved(LazyStateID)

An ID that of a state that has been persisted through a lazy DFA cache clearing. The ID recorded here corresponds to an ID that was once marked as ToSave. The IDs are likely not equivalent even though the states they point to are.

Implementations§

source§

impl StateSaver

source

fn none() -> StateSaver

Create an empty state saver.

source

fn take_to_save(&mut self) -> Option<(LazyStateID, State)>

Replace this state saver with an empty saver, and if this saver is a request to save a state, return that request.

source

fn take_saved(&mut self) -> Option<LazyStateID>

Replace this state saver with an empty saver, and if this saver is a saved state (or a request to save a state), return that state’s ID.

The idea here is that a request to save a state isn’t necessarily honored because it might not be needed. e.g., Some higher level code might request a state to be saved on the off chance that the cache gets cleared when a new state is added at a lower level. But if that new state is never added, then the cache is never cleared and the state and its ID remain unchanged.

Trait Implementations§

source§

impl Clone for StateSaver

source§

fn clone(&self) -> StateSaver

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 StateSaver

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.