Struct regex_automata::meta::strategy::Pre
source · struct Pre<P> {
pre: P,
group_info: GroupInfo,
}
Fields§
§pre: P
§group_info: GroupInfo
Implementations§
source§impl Pre<()>
impl Pre<()>
sourcefn from_prefixes(info: &RegexInfo, prefixes: &Seq) -> Option<Arc<dyn Strategy>>
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).
sourcefn from_alternation_literals(
info: &RegexInfo,
hirs: &[&Hir],
) -> Option<Arc<dyn Strategy>>
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: PrefilterI> Strategy for Pre<P>
impl<P: PrefilterI> Strategy for Pre<P>
fn group_info(&self) -> &GroupInfo
fn create_cache(&self) -> Cache
fn reset_cache(&self, _cache: &mut Cache)
fn is_accelerated(&self) -> bool
fn memory_usage(&self) -> usize
fn search(&self, _cache: &mut Cache, input: &Input<'_>) -> Option<Match>
fn search_half(&self, cache: &mut Cache, input: &Input<'_>) -> Option<HalfMatch>
fn is_match(&self, cache: &mut Cache, input: &Input<'_>) -> bool
fn search_slots( &self, cache: &mut Cache, input: &Input<'_>, slots: &mut [Option<NonMaxUsize>], ) -> Option<PatternID>
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> 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
)