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:
parent
ef7edb1061
commit
4762a75cfe
3 changed files with 84 additions and 0 deletions
src
|
@ -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>`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue