[][src]Struct ignore::gitignore::GitignoreBuilder

pub struct GitignoreBuilder { /* fields omitted */ }

Builds a matcher for a single set of globs from a .gitignore file.

Methods

impl GitignoreBuilder[src]

pub fn new<P: AsRef<Path>>(root: P) -> GitignoreBuilder[src]

Create a new builder for a gitignore file.

The path given should be the path at which the globs for this gitignore file should be matched. Note that paths are always matched relative to the root path given here. Generally, the root path should correspond to the directory containing a .gitignore file.

pub fn build(&self) -> Result<Gitignore, Error>[src]

Builds a new matcher from the globs added so far.

Once a matcher is built, no new globs can be added to it.

pub fn build_global(self) -> (Gitignore, Option<Error>)[src]

Build a global gitignore matcher using the configuration in this builder.

This consumes ownership of the builder unlike build because it must mutate the builder to add the global gitignore globs.

Note that this ignores the path given to this builder's constructor and instead derives the path automatically from git's global configuration.

pub fn add<P: AsRef<Path>>(&mut self, path: P) -> Option<Error>[src]

Add each glob from the file path given.

The file given should be formatted as a gitignore file.

Note that partial errors can be returned. For example, if there was a problem adding one glob, an error for that will be returned, but all other valid globs will still be added.

pub fn add_line(
    &mut self,
    from: Option<PathBuf>,
    line: &str
) -> Result<&mut GitignoreBuilder, Error>
[src]

Add a line from a gitignore file to this builder.

If this line came from a particular gitignore file, then its path should be provided here.

If the line could not be parsed as a glob, then an error is returned.

pub fn case_insensitive(
    &mut self,
    yes: bool
) -> Result<&mut GitignoreBuilder, Error>
[src]

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.

Trait Implementations

impl Clone for GitignoreBuilder[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for GitignoreBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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

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

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