Struct GlobBuilder
struct GlobBuilder<'a> { ... }
A builder for a pattern.
This builder enables configuring the match semantics of a pattern. For example, one can make matching case insensitive.
The lifetime 'a refers to the lifetime of the pattern string.
Implementations
impl<'a> GlobBuilder<'a>
fn new(glob: &'a str) -> GlobBuilder<'a>Create a new builder for the pattern given.
The pattern is not compiled until
buildis called.fn build(self: &Self) -> Result<Glob, Error>Parses and builds the pattern.
fn case_insensitive(self: &mut Self, yes: bool) -> &mut GlobBuilder<'a>Toggle whether the pattern matches case insensitively or not.
This is disabled by default.
fn literal_separator(self: &mut Self, yes: bool) -> &mut GlobBuilder<'a>Toggle whether a literal
/is required to match a path separator.By default this is false:
*and?will match/.fn backslash_escape(self: &mut Self, yes: bool) -> &mut GlobBuilder<'a>When enabled, a back slash (
\) may be used to escape special characters in a glob pattern. Additionally, this will prevent\from being interpreted as a path separator on all platforms.This is enabled by default on platforms where
\is not a path separator and disabled by default on platforms where\is a path separator.fn empty_alternates(self: &mut Self, yes: bool) -> &mut GlobBuilder<'a>Toggle whether an empty pattern in a list of alternates is accepted.
For example, if this is set then the glob
foo{,.txt}will match bothfooandfoo.txt.By default this is false.
fn allow_unclosed_class(self: &mut Self, yes: bool) -> &mut GlobBuilder<'a>Toggle whether unclosed character classes are allowed. When allowed, a
[without a matching]is treated literally instead of resulting in a parse error.For example, if this is set then the glob
[abcwill be treated as the literal string[abcinstead of returning an error.By default, this is false. Generally speaking, enabling this leads to worse failure modes since the glob parser becomes more permissive. You might want to enable this when compatibility (e.g., with POSIX glob implementations) is more important than good error messages.
impl<'a> Clone for GlobBuilder<'a>
fn clone(self: &Self) -> GlobBuilder<'a>
impl<'a> Debug for GlobBuilder<'a>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<'a> Freeze for GlobBuilder<'a>
impl<'a> RefUnwindSafe for GlobBuilder<'a>
impl<'a> Send for GlobBuilder<'a>
impl<'a> Sync for GlobBuilder<'a>
impl<'a> Unpin for GlobBuilder<'a>
impl<'a> UnsafeUnpin for GlobBuilder<'a>
impl<'a> UnwindSafe for GlobBuilder<'a>
impl<T> Any for GlobBuilder<'a>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for GlobBuilder<'a>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for GlobBuilder<'a>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for GlobBuilder<'a>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for GlobBuilder<'a>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for GlobBuilder<'a>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for GlobBuilder<'a>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for GlobBuilder<'a>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for GlobBuilder<'a>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>