pub enum StringExpression {
Pattern(Box<StringPattern>),
NotIn(Box<StringExpression>),
Union(Box<StringExpression>, Box<StringExpression>),
Intersection(Box<StringExpression>, Box<StringExpression>),
}Expand description
AST-level representation of the string matcher expression.
Variants§
Pattern(Box<StringPattern>)
Matches pattern.
NotIn(Box<StringExpression>)
Matches anything other than the expression.
Union(Box<StringExpression>, Box<StringExpression>)
Matches one of the expressions.
Intersection(Box<StringExpression>, Box<StringExpression>)
Matches both expressions.
Implementations§
Source§impl StringExpression
impl StringExpression
Sourcepub fn none() -> StringExpression
pub fn none() -> StringExpression
Expression that matches nothing.
Sourcepub fn all() -> StringExpression
pub fn all() -> StringExpression
Expression that matches everything.
Sourcepub fn pattern(pattern: StringPattern) -> StringExpression
pub fn pattern(pattern: StringPattern) -> StringExpression
Expression that matches the given pattern.
Sourcepub fn exact(src: impl Into<String>) -> StringExpression
pub fn exact(src: impl Into<String>) -> StringExpression
Expression that matches strings exactly.
Sourcepub fn substring(src: impl Into<String>) -> StringExpression
pub fn substring(src: impl Into<String>) -> StringExpression
Expression that matches substrings.
Sourcepub fn negated(self) -> StringExpression
pub fn negated(self) -> StringExpression
Expression that matches anything other than this expression.
Sourcepub fn union(self, other: StringExpression) -> StringExpression
pub fn union(self, other: StringExpression) -> StringExpression
Expression that matches self or other (or both).
Sourcepub fn union_all(expressions: Vec<StringExpression>) -> StringExpression
pub fn union_all(expressions: Vec<StringExpression>) -> StringExpression
Expression that matches any of the given expressions.
Sourcepub fn intersection(self, other: StringExpression) -> StringExpression
pub fn intersection(self, other: StringExpression) -> StringExpression
Expression that matches both self and other.
Sourcepub fn exact_strings(&self) -> impl Iterator<Item = &str>
pub fn exact_strings(&self) -> impl Iterator<Item = &str>
Iterates exact string patterns recursively from this expression.
For example, "a", "b", "c" will be yielded in that order for
expression "a" | glob:"?" & "b" | ~"c".
Sourcepub fn to_matcher(&self) -> StringMatcher
pub fn to_matcher(&self) -> StringMatcher
Transforms the expression tree to matcher object.
Trait Implementations§
Source§impl Clone for StringExpression
impl Clone for StringExpression
Source§fn clone(&self) -> StringExpression
fn clone(&self) -> StringExpression
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for StringExpression
impl RefUnwindSafe for StringExpression
impl Send for StringExpression
impl Sync for StringExpression
impl Unpin for StringExpression
impl UnsafeUnpin for StringExpression
impl UnwindSafe for StringExpression
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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