Struct regex_automata::meta::strategy::Pre

source ·
struct Pre<P> {
    pre: P,
    group_info: GroupInfo,
}

Fields§

§pre: P§group_info: GroupInfo

Implementations§

source§

impl<P: PrefilterI> Pre<P>

source

fn new(pre: P) -> Arc<dyn Strategy>

source§

impl Pre<()>

source

fn from_prefixes(info: &RegexInfo, prefixes: &Seq) -> Option<Arc<dyn Strategy>>

Given a sequence of prefixes, attempt to return a full Strategy using just the prefixes.

Basically, this occurs when the prefixes given not just prefixes, but an enumeration of the entire language matched by the regular expression.

A number of other conditions need to be true too. For example, there can be only one pattern, the number of explicit capture groups is 0, no look-around assertions and so on.

Note that this ignores Config::get_auto_prefilter because if this returns something, then it isn’t a prefilter but a matcher itself. Therefore, it shouldn’t suffer from the problems typical to prefilters (such as a high false positive rate).

source

fn from_alternation_literals( info: &RegexInfo, hirs: &[&Hir], ) -> Option<Arc<dyn Strategy>>

Attempts to extract an alternation of literals, and if it’s deemed worth doing, returns an Aho-Corasick prefilter as a strategy.

And currently, this only returns something when ‘hirs.len() == 1’. This could in theory do something if there are multiple HIRs where all of them are alternation of literals, but I haven’t had the time to go down that path yet.

Trait Implementations§

source§

impl<P: Clone> Clone for Pre<P>

source§

fn clone(&self) -> Pre<P>

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<P: Debug> Debug for Pre<P>

source§

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

Formats the value using the given formatter. Read more
source§

impl<P: PrefilterI> Strategy for Pre<P>

source§

fn group_info(&self) -> &GroupInfo

source§

fn create_cache(&self) -> Cache

source§

fn reset_cache(&self, _cache: &mut Cache)

source§

fn is_accelerated(&self) -> bool

source§

fn memory_usage(&self) -> usize

source§

fn search(&self, _cache: &mut Cache, input: &Input<'_>) -> Option<Match>

source§

fn search_half(&self, cache: &mut Cache, input: &Input<'_>) -> Option<HalfMatch>

source§

fn is_match(&self, cache: &mut Cache, input: &Input<'_>) -> bool

source§

fn search_slots( &self, cache: &mut Cache, input: &Input<'_>, slots: &mut [Option<NonMaxUsize>], ) -> Option<PatternID>

source§

fn which_overlapping_matches( &self, cache: &mut Cache, input: &Input<'_>, patset: &mut PatternSet, )

Auto Trait Implementations§

§

impl<P> Freeze for Pre<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for Pre<P>
where P: RefUnwindSafe,

§

impl<P> Send for Pre<P>
where P: Send,

§

impl<P> Sync for Pre<P>
where P: Sync,

§

impl<P> Unpin for Pre<P>
where P: Unpin,

§

impl<P> UnwindSafe for Pre<P>
where P: UnwindSafe,

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.