[−][src]Struct gitignored::Gitignore
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]
root: P,
require_literal_separator: bool,
case_insensitive: bool
) -> Gitignore<P>
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
Auto Trait Implementations
impl<P> RefUnwindSafe for Gitignore<P> where
P: RefUnwindSafe,
P: RefUnwindSafe,
impl<P> Send for Gitignore<P> where
P: Send,
P: Send,
impl<P> Sync for Gitignore<P> where
P: Sync,
P: Sync,
impl<P> Unpin for Gitignore<P> where
P: Unpin,
P: Unpin,
impl<P> UnwindSafe for Gitignore<P> where
P: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,