pub struct Pattern<'a, HaystackStr>where
HaystackStr: EncodedStr + ?Sized,{ /* private fields */ }
Implementations§
Source§impl<'a> Pattern<'a, str>
impl<'a> Pattern<'a, str>
Sourcepub fn parse_ev(pattern: &'a str) -> PatternParseEvBuilder<'a>
Available on (crate features syntax-glob
or syntax-ev
or syntax-regex
) and crate feature syntax-ev
only.
pub fn parse_ev(pattern: &'a str) -> PatternParseEvBuilder<'a>
syntax-glob
or syntax-ev
or syntax-regex
) and crate feature syntax-ev
only.Parse a pattern according to the syntax used by IbEverythingExt.
;en
,;py
and;rm
postmodifiers are mutually exclusive. If multiple are present, only the last one will be considered as a postmodifier.
Only UTF-8 pattern is supported at the moment.
§Example
use ib_matcher::{matcher::{IbMatcher, PinyinMatchConfig, pattern::Pattern}, pinyin::PinyinNotation};
let matcher = IbMatcher::builder(Pattern::parse_ev("pinyin;py").call())
.pinyin(PinyinMatchConfig::notations(PinyinNotation::Ascii))
.build();
assert!(matcher.is_match("拼音搜索"));
assert!(matcher.is_match("pinyin") == false);
Trait Implementations§
Source§impl<'a, HaystackStr> From<&'a HaystackStr> for Pattern<'a, HaystackStr>where
HaystackStr: EncodedStr + ?Sized,
impl<'a, HaystackStr> From<&'a HaystackStr> for Pattern<'a, HaystackStr>where
HaystackStr: EncodedStr + ?Sized,
Source§fn from(value: &'a HaystackStr) -> Self
fn from(value: &'a HaystackStr) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a, HaystackStr> Freeze for Pattern<'a, HaystackStr>where
HaystackStr: ?Sized,
impl<'a, HaystackStr> RefUnwindSafe for Pattern<'a, HaystackStr>where
HaystackStr: RefUnwindSafe + ?Sized,
impl<'a, HaystackStr> Send for Pattern<'a, HaystackStr>
impl<'a, HaystackStr> Sync for Pattern<'a, HaystackStr>
impl<'a, HaystackStr> Unpin for Pattern<'a, HaystackStr>where
HaystackStr: ?Sized,
impl<'a, HaystackStr> UnwindSafe for Pattern<'a, HaystackStr>where
HaystackStr: RefUnwindSafe + ?Sized,
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more