pub enum FilesetExpression {
None,
All,
Pattern(FilePattern),
UnionAll(Vec<FilesetExpression>),
Intersection(Box<FilesetExpression>, Box<FilesetExpression>),
Difference(Box<FilesetExpression>, Box<FilesetExpression>),
}
Expand description
AST-level representation of the fileset expression.
Variants§
None
Matches nothing.
All
Matches everything.
Pattern(FilePattern)
Matches basic pattern.
UnionAll(Vec<FilesetExpression>)
Matches any of the expressions.
Use FilesetExpression::union_all()
to construct a union expression.
It will normalize 0-ary or 1-ary union.
Intersection(Box<FilesetExpression>, Box<FilesetExpression>)
Matches both expressions.
Difference(Box<FilesetExpression>, Box<FilesetExpression>)
Matches the first expression, but not the second expression.
Implementations§
Source§impl FilesetExpression
impl FilesetExpression
Sourcepub fn pattern(pattern: FilePattern) -> Self
pub fn pattern(pattern: FilePattern) -> Self
Expression that matches the given pattern
.
Sourcepub fn file_path(path: RepoPathBuf) -> Self
pub fn file_path(path: RepoPathBuf) -> Self
Expression that matches file (or exact) path.
Sourcepub fn prefix_path(path: RepoPathBuf) -> Self
pub fn prefix_path(path: RepoPathBuf) -> Self
Expression that matches path prefix.
Sourcepub fn union_all(expressions: Vec<FilesetExpression>) -> Self
pub fn union_all(expressions: Vec<FilesetExpression>) -> Self
Expression that matches any of the given expressions
.
Sourcepub fn intersection(self, other: Self) -> Self
pub fn intersection(self, other: Self) -> Self
Expression that matches both self
and other
.
Sourcepub fn difference(self, other: Self) -> Self
pub fn difference(self, other: Self) -> Self
Expression that matches self
but not other
.
Sourcepub fn explicit_paths(&self) -> impl Iterator<Item = &RepoPath>
pub fn explicit_paths(&self) -> impl Iterator<Item = &RepoPath>
Iterates literal paths recursively from this expression.
For example, "a", "b", "c"
will be yielded in that order for
expression "a" | all() & "b" | ~"c"
.
Sourcepub fn to_matcher(&self) -> Box<dyn Matcher>
pub fn to_matcher(&self) -> Box<dyn Matcher>
Transforms the expression tree to Matcher
object.
Trait Implementations§
Source§impl Clone for FilesetExpression
impl Clone for FilesetExpression
Source§fn clone(&self) -> FilesetExpression
fn clone(&self) -> FilesetExpression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for FilesetExpression
impl RefUnwindSafe for FilesetExpression
impl Send for FilesetExpression
impl Sync for FilesetExpression
impl Unpin for FilesetExpression
impl UnwindSafe for FilesetExpression
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§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