Struct Glob

struct Glob { ... }

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

impl Glob

fn new(glob: &str) -> Result<Glob, Error>

Builds a new pattern with default options.

fn compile_matcher(self: &Self) -> GlobMatcher

Returns a matcher for this pattern.

fn glob(self: &Self) -> &str

Returns the original glob pattern used to build this pattern.

fn regex(self: &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.

impl AsRef for Glob

fn as_ref(self: &Self) -> &Glob

impl Clone for Glob

fn clone(self: &Self) -> Glob

impl Debug for Glob

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Display for Glob

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Eq for Glob

impl Freeze for Glob

impl FromStr for Glob

fn from_str(glob: &str) -> Result<Self, <Self as >::Err>

impl Hash for Glob

fn hash<H: std::hash::Hasher>(self: &Self, state: &mut H)

impl PartialEq for Glob

fn eq(self: &Self, other: &Glob) -> bool

impl RefUnwindSafe for Glob

impl Send for Glob

impl Sync for Glob

impl Unpin for Glob

impl UnsafeUnpin for Glob

impl UnwindSafe for Glob

impl<T> Any for Glob

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Glob

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Glob

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Glob

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Glob

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Glob

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> ToString for Glob

fn to_string(self: &Self) -> String

impl<T, U> Into for Glob

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Glob

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Glob

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>