[]Struct libhandy4::Error

pub struct Error(_);

A generic error capable of representing various error domains (types).

Implementations

impl Error

pub fn new<T>(error: T, message: &str) -> Error where
    T: ErrorDomain, 

Creates an error with supplied error enum variant and message.

pub fn is<T>(&self) -> bool where
    T: ErrorDomain, 

Checks if the error domain matches T.

pub fn kind<T>(&self) -> Option<T> where
    T: ErrorDomain, 

Tries to convert to a specific error enum.

Returns Some if the error belongs to the enum's error domain and None otherwise.

Examples

This example is not tested
if let Some(file_error) = error.kind::<FileError>() {
    match file_error {
        FileError::Exist => ...
        FileError::Isdir => ...
        ...
    }
}
This example is not tested
match error.kind::<FileError>() {
    Some(FileError::Exist) => ...
    Some(FileError::Isdir) => ...
    ...
}

Trait Implementations

impl Clone for Error

impl Debug for Error

impl Display for Error

impl Eq for Error

impl Error for Error

impl Hash for Error

impl Ord for Error

impl PartialEq<Error> for Error

impl PartialOrd<Error> for Error

impl Send for Error

impl StaticType for Error

impl StructuralEq for Error

impl StructuralPartialEq for Error

impl Sync for Error

Auto Trait Implementations

impl RefUnwindSafe for Error[src]

impl Unpin for Error[src]

impl UnwindSafe for Error[src]

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

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

impl<T> ToValue for T where
    T: SetValue + ?Sized

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.