1
0
Fork 0
mirror of https://github.com/haraldh/chainerror.git synced 2025-06-22 22:34:34 +02:00

impl Deref for ChainError

This commit is contained in:
Harald Hoyer 2019-02-01 11:40:46 +01:00
parent ef7edb1061
commit 4762a75cfe
3 changed files with 84 additions and 0 deletions

View file

@ -374,6 +374,14 @@ impl<'a> Iterator for ErrorIter<'a> {
}
}
impl<T: 'static + Display + Debug> std::ops::Deref for ChainError<T> {
type Target = T;
fn deref(&self) -> &Self::Target {
self.kind()
}
}
/// Convenience trait to hide the `ChainError<T>` implementation internals
pub trait ChainErrorDown {
/// Test if of type `ChainError<T>`