[][src]Struct gitignored::Gitignore

pub struct Gitignore<P: AsRef<Path>> {
    pub root: P,
    // some fields omitted
}

Used to match globs against user-provided paths.

Fields

root: P

Current working directory if created with Gitignore::default().

Implementations

impl<P: AsRef<Path>> Gitignore<P>[src]

pub fn new(
    root: P,
    require_literal_separator: bool,
    case_insensitive: bool
) -> Gitignore<P>
[src]

Creates a new instance. Requires a path that serves as a root for all path calculations and matching options as defined in the glob crate.

Examples

let cwd = env::current_dir().unwrap();
let ig = Gitignore::new(cwd, true, true);

pub fn ignores(&mut self, lines: &[&str], target: impl AsRef<Path>) -> bool[src]

Checks if the target is ignored by provided list of gitignore patterns.

Examples

let globs = vec!["lib/*.js", "!lib/include.js"];
assert!(!ig.ignores(&globs, ig.root.join("lib/include.js")));

Trait Implementations

impl Default for Gitignore<PathBuf>[src]

fn default() -> Self[src]

Creates a new instance using current working directory.

Auto Trait Implementations

impl<P> RefUnwindSafe for Gitignore<P> where
    P: RefUnwindSafe

impl<P> Send for Gitignore<P> where
    P: Send

impl<P> Sync for Gitignore<P> where
    P: Sync

impl<P> Unpin for Gitignore<P> where
    P: Unpin

impl<P> UnwindSafe for Gitignore<P> where
    P: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.