pub struct Glob { /* private fields */ }
Expand description
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.
Implementations§
source§impl Glob
impl Glob
sourcepub fn compile_matcher(&self) -> GlobMatcher
pub fn compile_matcher(&self) -> GlobMatcher
Returns a matcher for this pattern.
sourcepub fn regex(&self) -> &str
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§
source§impl<'de> Deserialize<'de> for Glob
impl<'de> Deserialize<'de> for Glob
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for Glob
Auto Trait Implementations§
impl Freeze for Glob
impl RefUnwindSafe for Glob
impl Send for Glob
impl Sync for Glob
impl Unpin for Glob
impl UnwindSafe for Glob
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)