Struct OverlappingState

pub struct OverlappingState { /* private fields */ }

Represents the current state of an overlapping search.

This is used for overlapping searches since they need to know something about the previous search. For example, when multiple patterns match at the same position, this state tracks the last reported pattern so that the next search knows whether to report another matching pattern or continue with the search at the next position. Additionally, it also tracks which state the last search call terminated in.

This type provides little introspection capabilities. The only thing a caller can do is construct it and pass it around to permit search routines to use it to track state, and also ask whether a match has been found.

Callers should always provide a fresh state constructed via OverlappingState::start when starting a new search. Reusing state from a previous search may result in incorrect results.

Implementations

impl OverlappingState

fn start() -> OverlappingState

Create a new overlapping state that begins at the start state of any automaton.

fn get_match(&self) -> Option<HalfMatch>

Return the match result of the most recent search to execute with this state.

A searches will clear this result automatically, such that if no match is found, this will correctly report None.

Trait Implementations

impl Clone for OverlappingState

fn clone(&self) -> Self

impl Debug for OverlappingState

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

impl Eq for OverlappingState

impl PartialEq for OverlappingState

fn eq(&self, other: &Self) -> bool

impl StructuralPartialEq for OverlappingState

Auto Trait Implementations

impl Freeze for OverlappingState

impl RefUnwindSafe for OverlappingState

impl Send for OverlappingState

impl Sync for OverlappingState

impl Unpin for OverlappingState

impl UnsafeUnpin for OverlappingState

impl UnwindSafe for OverlappingState

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for OverlappingState

fn from(t: T) -> T

Returns the argument unchanged.

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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