Pattern

Struct Pattern 

Source
pub struct Pattern<'a, HaystackStr>
where HaystackStr: EncodedStr + ?Sized,
{ /* private fields */ }

Implementations§

Source§

impl<'a> Pattern<'a, str>

Source

pub 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.

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> Debug for Pattern<'a, HaystackStr>
where HaystackStr: EncodedStr + ?Sized + Debug,

Source§

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

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

impl<'a, HaystackStr> From<&'a HaystackStr> for Pattern<'a, HaystackStr>
where HaystackStr: EncodedStr + ?Sized,

Source§

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>
where HaystackStr: Sync + ?Sized,

§

impl<'a, HaystackStr> Sync for Pattern<'a, HaystackStr>
where HaystackStr: Sync + ?Sized,

§

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> 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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.