[][src]Enum ignore::Error

pub enum Error {
    Partial(Vec<Error>),
    WithLineNumber {
        line: u64,
        err: Box<Error>,
    },
    WithPath {
        path: PathBuf,
        err: Box<Error>,
    },
    WithDepth {
        depth: usize,
        err: Box<Error>,
    },
    Loop {
        ancestor: PathBuf,
        child: PathBuf,
    },
    Io(Error),
    Glob {
        glob: Option<String>,
        err: String,
    },
    UnrecognizedFileType(String),
    InvalidDefinition,
}

Represents an error that can occur when parsing a gitignore file.

Variants

Partial(Vec<Error>)

A collection of "soft" errors. These occur when adding an ignore file partially succeeded.

WithLineNumber

An error associated with a specific line number.

Fields of WithLineNumber

line: u64

The line number.

err: Box<Error>

The underlying error.

WithPath

An error associated with a particular file path.

Fields of WithPath

path: PathBuf

The file path.

err: Box<Error>

The underlying error.

WithDepth

An error associated with a particular directory depth when recursively walking a directory.

Fields of WithDepth

depth: usize

The directory depth.

err: Box<Error>

The underlying error.

Loop

An error that occurs when a file loop is detected when traversing symbolic links.

Fields of Loop

ancestor: PathBuf

The ancestor file path in the loop.

child: PathBuf

The child file path in the loop.

Io(Error)

An error that occurs when doing I/O, such as reading an ignore file.

Glob

An error that occurs when trying to parse a glob.

Fields of Glob

glob: Option<String>

The original glob that caused this error. This glob, when available, always corresponds to the glob provided by an end user. e.g., It is the glob as written in a .gitignore file.

(This glob may be distinct from the glob that is actually compiled, after accounting for gitignore semantics.)

err: String

The underlying glob error as a string.

UnrecognizedFileType(String)

A type selection for a file type that is not defined.

InvalidDefinition

A user specified file type definition could not be parsed.

Methods

impl Error[src]

pub fn is_partial(&self) -> bool[src]

Returns true if this is a partial error.

A partial error occurs when only some operations failed while others may have succeeded. For example, an ignore file may contain an invalid glob among otherwise valid globs.

pub fn is_io(&self) -> bool[src]

Returns true if this error is exclusively an I/O error.

pub fn depth(&self) -> Option<usize>[src]

Returns a depth associated with recursively walking a directory (if this error was generated from a recursive directory iterator).

Trait Implementations

impl Clone for Error[src]

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

Performs copy-assignment from source. Read more

impl From<Error> for Error[src]

impl Display for Error[src]

impl Debug for Error[src]

impl Error for Error[src]

default fn cause(&self) -> Option<&dyn Error>
1.0.0
[src]

Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

The lower-level cause of this error, if any. Read more

default fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0
[src]

The lower-level source of this error, if any. Read more

default fn type_id(&self) -> TypeId where
    Self: 'static, 
1.34.0
[src]

Gets the TypeId of self

Auto Trait Implementations

impl Send for Error

impl Sync for Error

Blanket Implementations

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

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.