Struct Override

pub struct Override(/* private field */);

Manages a set of overrides provided explicitly by the end user.

Implementations

impl Override

fn empty() -> Override

Returns an empty matcher that never matches any file path.

fn path(&self) -> &Path

Returns the directory of this override set.

All matches are done relative to this path.

fn is_empty(&self) -> bool

Returns true if and only if this matcher is empty.

When a matcher is empty, it will never match any file path.

fn num_ignores(&self) -> u64

Returns the total number of ignore globs.

fn num_whitelists(&self) -> u64

Returns the total number of whitelisted globs.

fn matched<'a, P: AsRef<Path>>(&'a self, path: P, is_dir: bool) -> Match<Glob<'a>>

Returns whether the given file path matched a pattern in this override matcher.

is_dir should be true if the path refers to a directory and false otherwise.

If there are no overrides, then this always returns Match::None.

If there is at least one whitelist override and is_dir is false, then this never returns Match::None, since non-matches are interpreted as ignored.

The given path is matched to the globs relative to the path given when building the override matcher. Specifically, before matching path, its prefix (as determined by a common suffix of the directory given) is stripped. If there is no common suffix/prefix overlap, then path is assumed to reside in the same directory as the root path for this set of overrides.

Trait Implementations

impl Clone for Override

fn clone(&self) -> Override

impl Debug for Override

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

Auto Trait Implementations

impl Freeze for Override

impl RefUnwindSafe for Override

impl Send for Override

impl Sync for Override

impl Unpin for Override

impl UnsafeUnpin for Override

impl UnwindSafe for Override

Blanket Implementations

impl<T> Any for Override where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Override where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Override where T: ?Sized,

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

impl<T> CloneToUninit for Override where T: Clone,

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

impl<T> From<T> for Override

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Pointable for Override

const ALIGN: usize = _;
type Init = T;
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

impl<T> ToOwned for Override where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Override where U: From<T>,

fn into(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<U> for Override where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Override where U: TryFrom<T>,

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