[][src]Struct git2::Error

pub struct Error { /* fields omitted */ }

A structure to represent errors coming out of libgit2.

Methods

impl Error[src]

pub fn last_error(code: c_int) -> Option<Error>[src]

Returns the last error that happened with the code specified by code.

The code argument typically comes from the return value of a function call. This code will later be returned from the code function.

Historically this function returned Some or None based on the return value of git_error_last but nowadays it always returns Some so it's safe to unwrap the return value. This API will change in the next major version.

pub fn from_str(s: &str) -> Error[src]

Creates a new error from the given string as the error.

The error returned will have the code GIT_ERROR and the class GIT_ERROR_NONE.

pub fn code(&self) -> ErrorCode[src]

Return the error code associated with this error.

An error code is intended to be programmatically actionable most of the time. For example the code GIT_EAGAIN indicates that an error could be fixed by trying again, while the code GIT_ERROR is more bland and doesn't convey anything in particular.

pub fn class(&self) -> ErrorClass[src]

Return the error class associated with this error.

Error classes are in general mostly just informative. For example the class will show up in the error message but otherwise an error class is typically not directly actionable.

pub fn raw_code(&self) -> git_error_code[src]

Return the raw error code associated with this error.

pub fn raw_class(&self) -> git_error_t[src]

Return the raw error class associated with this error.

pub fn message(&self) -> &str[src]

Return the message associated with this error

Trait Implementations

impl From<NulError> for Error[src]

impl From<JoinPathsError> for Error[src]

impl PartialEq<Error> for Error[src]

impl Display for Error[src]

impl Debug for Error[src]

impl StructuralPartialEq for Error[src]

impl Error for Error[src]

Auto Trait Implementations

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl UnwindSafe for Error

impl RefUnwindSafe for Error

Blanket Implementations

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[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> Borrow<T> for T where
    T: ?Sized
[src]

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

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