Struct OverrideBuilder
struct OverrideBuilder { ... }
Builds a matcher for a set of glob overrides.
Implementations
impl OverrideBuilder
fn new<P: AsRef<Path>>(path: P) -> OverrideBuilderCreate a new override builder.
Matching is done relative to the directory path provided.
fn build(self: &Self) -> Result<Override, Error>Builds a new override matcher from the globs added so far.
Once a matcher is built, no new globs can be added to it.
fn add(self: &mut Self, glob: &str) -> Result<&mut OverrideBuilder, Error>Add a glob to the set of overrides.
Globs provided here have precisely the same semantics as a single line in a
gitignorefile, where the meaning of!is inverted: namely,!at the beginning of a glob will ignore a file. Without!, all matches of the glob provided are treated as whitelist matches.fn case_insensitive(self: &mut Self, yes: bool) -> Result<&mut OverrideBuilder, Error>Toggle whether the globs should be matched case insensitively or not.
When this option is changed, only globs added after the change will be affected.
This is disabled by default.
fn allow_unclosed_class(self: &mut Self, yes: bool) -> &mut OverrideBuilderToggle 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.
This default is different from the default for
Gitignore. Namely,Gitignoreis intended to match git's behavior as-is. But this abstraction for "override" globs does not necessarily conform to any other known specification and instead prioritizes better error messages.
impl Clone for OverrideBuilder
fn clone(self: &Self) -> OverrideBuilder
impl Debug for OverrideBuilder
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Freeze for OverrideBuilder
impl RefUnwindSafe for OverrideBuilder
impl Send for OverrideBuilder
impl Sync for OverrideBuilder
impl Unpin for OverrideBuilder
impl UnwindSafe for OverrideBuilder
impl<T> Any for OverrideBuilder
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for OverrideBuilder
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for OverrideBuilder
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for OverrideBuilder
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for OverrideBuilder
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Pointable for OverrideBuilder
unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> ToOwned for OverrideBuilder
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for OverrideBuilder
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 OverrideBuilder
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for OverrideBuilder
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>