[−][src]Struct filenamegen::Glob
Represents a compiled glob expression.
Depending on the pattern, evaluating the glob may use a conservative
walker that tries to minimize the number of syscalls to just the
directories in which pattern matching needs to occur.
If the recursive glob **
pattern is used then we have no choice
but to perform a full tree walk for the appropriate portions of
the filesystem.
Methods
impl Glob
[src]
pub fn new(pattern: &str) -> Result<Glob>
[src]
Compile pattern into a Glob
Special characters allowed in pattern:
?
match any single non-directory separator character,
except for a leading .
in the directory entry name
(this allows hiding files using the unix convention
of a leading dot)
*
like ?
except matches 0 or more characters.
\
quotes the character that follows it, preventing it from
interpreted as a special character.
**
, when used in its own non-leaf directory component, acts as a
recursive wildcard, matching any number of directories.
When used in the leaf position it acts the same as *
.
{foo,bar}.rs
matches both foo.rs
and bar.rs
. The curly braces
define an alternation regex.
pub fn walk<P: AsRef<Path>>(&self, path: P) -> Vec<PathBuf>
[src]
Walk the filesystem starting at path
and execute the glob.
Returns all matching entries in sorted order. The entries are
relative to path
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Glob
impl Send for Glob
impl Sync for Glob
impl Unpin for Glob
impl UnwindSafe for Glob
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,