Struct globset::Glob [−][src]
pub struct Glob { /* fields omitted */ }
Glob represents a successfully parsed shell glob pattern.
It cannot be used directly to match file paths, but it can be converted to a regular expression string or a matcher.
Methods
impl Glob
[src]
impl Glob
pub fn new(glob: &str) -> Result<Glob, Error>
[src]
pub fn new(glob: &str) -> Result<Glob, Error>
Builds a new pattern with default options.
pub fn compile_matcher(&self) -> GlobMatcher
[src]
pub fn compile_matcher(&self) -> GlobMatcher
Returns a matcher for this pattern.
pub fn glob(&self) -> &str
[src]
pub fn glob(&self) -> &str
Returns the original glob pattern used to build this pattern.
pub fn regex(&self) -> &str
[src]
pub fn regex(&self) -> &str
Returns the regular expression string for this glob.
Note that regular expressions for globs are intended to be matched on
arbitrary bytes (&[u8]
) instead of Unicode strings (&str
). In
particular, globs are frequently used on file paths, where there is no
general guarantee that file paths are themselves valid UTF-8. As a
result, callers will need to ensure that they are using a regex API
that can match on arbitrary bytes. For example, the
regex
crate's
Regex
API is not suitable for this since it matches on &str
, but its
bytes::Regex
API is suitable for this.
Trait Implementations
impl Clone for Glob
[src]
impl Clone for Glob
fn clone(&self) -> Glob
[src]
fn clone(&self) -> Glob
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Glob
[src]
impl Debug for Glob
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Eq for Glob
[src]
impl Eq for Glob
impl PartialEq for Glob
[src]
impl PartialEq for Glob
fn eq(&self, other: &Glob) -> bool
[src]
fn eq(&self, other: &Glob) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Hash for Glob
[src]
impl Hash for Glob
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash<H: Hasher>(&self, state: &mut H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for Glob
[src]
impl Display for Glob