Move Chain implementation to chain.rs

This commit is contained in:
David Tolnay 2019-11-17 13:56:58 -08:00
parent 7246344a3e
commit a8c199b37d
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
3 changed files with 13 additions and 10 deletions

12
src/chain.rs Normal file
View File

@ -0,0 +1,12 @@
use crate::Chain;
use std::error::Error as StdError;
impl<'a> Iterator for Chain<'a> {
type Item = &'a (dyn StdError + 'static);
fn next(&mut self) -> Option<Self::Item> {
let next = self.next?;
self.next = next.source();
Some(next)
}
}

View File

@ -726,13 +726,3 @@ impl From<Error> for Box<dyn StdError + 'static> {
Box::<dyn StdError + Send + Sync>::from(error)
}
}
impl<'a> Iterator for Chain<'a> {
type Item = &'a (dyn StdError + 'static);
fn next(&mut self) -> Option<Self::Item> {
let next = self.next?;
self.next = next.source();
Some(next)
}
}

View File

@ -169,6 +169,7 @@
#[macro_use]
mod backtrace;
mod chain;
mod context;
mod error;
mod fmt;