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

12
booksrc/tutorial12.md Normal file
View file

@ -0,0 +1,12 @@
# Deref for the ErrorKind
Because ChainError<T> implements Deref to &T, we can also match on `*e` instead of `e.kind()`.
~~~rust
use crate::chainerror::*;
{{#include ../examples/tutorial12.rs:2:}}
# #[allow(dead_code)]
# mod chainerror {
{{#includecomment ../src/lib.rs}}
# }
~~~