[−][src]Struct gitignore::File
Represents a .gitignore
file. Use this to load the .gitignore
file, parse the patterns,
and then check if a given path would be excluded by any rules contained therein.
Examples
let file = gitignore::File::new(&gitignore_path).unwrap(); assert!(file.is_excluded(&path_to_test_if_excluded).unwrap())
Implementations
impl<'b> File<'b>
[src]
pub fn new(gitignore_path: &'b Path) -> Result<File<'b>, Error>
[src]
Parse the given .gitignore
file for patterns, allowing any arbitrary path to be checked
against the set of rules to test for exclusion.
The value of gitignore_path
must be an absolute path.
pub fn is_excluded(&self, path: &'b Path) -> Result<bool, Error>
[src]
Returns true if, after checking against all the patterns found in the .gitignore
file,
the given path is matched any of the globs (applying negated patterns as expected). Note
this function also returns false if the path does not exist.
If the value for path
is not absolute, it will assumed to be relative to the current
working directory.
pub fn included_files(&self) -> Result<Vec<PathBuf>, Error>
[src]
Returns a list of files that are not excluded by the rules in the loaded
.gitignore
file. It recurses through all subdirectories and returns
everything that is not ignored.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for File<'a>
impl<'a> Send for File<'a>
impl<'a> Sync for File<'a>
impl<'a> Unpin for File<'a>
impl<'a> UnwindSafe for File<'a>
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>,