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.
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
impl StateSaver
sourcefn none() -> StateSaver
fn none() -> StateSaver
Create an empty state saver.
sourcefn take_to_save(&mut self) -> Option<(LazyStateID, State)>
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.
sourcefn take_saved(&mut self) -> Option<LazyStateID>
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
impl Clone for StateSaver
source§fn clone(&self) -> StateSaver
fn clone(&self) -> StateSaver
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for StateSaver
impl RefUnwindSafe for StateSaver
impl Send for StateSaver
impl Sync for StateSaver
impl Unpin for StateSaver
impl UnwindSafe for StateSaver
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)