Struct anyhow::Chain[][src]

pub struct Chain<'a> { /* fields omitted */ }

Iterator of a chain of source errors.

This type is the iterator returned by Error::chain.

Example

use anyhow::Error;
use std::io;

pub fn underlying_io_error_kind(error: &Error) -> Option<io::ErrorKind> {
    for cause in error.chain() {
        if let Some(io_error) = cause.downcast_ref::<io::Error>() {
            return Some(io_error.kind());
        }
    }
    None
}

Implementations

impl<'a> Chain<'a>[src]

pub fn new(head: &'a (dyn StdError + 'static)) -> Self[src]

Trait Implementations

impl<'a> Clone for Chain<'a>[src]

impl Default for Chain<'_>[src]

impl DoubleEndedIterator for Chain<'_>[src]

impl ExactSizeIterator for Chain<'_>[src]

impl<'a> Iterator for Chain<'a>[src]

type Item = &'a (dyn StdError + 'static)

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Chain<'a>

impl<'a> !Send for Chain<'a>

impl<'a> !Sync for Chain<'a>

impl<'a> Unpin for Chain<'a>

impl<'a> !UnwindSafe for Chain<'a>

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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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

type Owned = T

The resulting type after obtaining ownership.

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.