mirror of
https://github.com/haraldh/chainerror.git
synced 2025-05-31 22:08:07 +02:00
impl Deref for ChainError
This commit is contained in:
parent
ef7edb1061
commit
4762a75cfe
3 changed files with 84 additions and 0 deletions
12
booksrc/tutorial12.md
Normal file
12
booksrc/tutorial12.md
Normal 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}}
|
||||
# }
|
||||
~~~
|
Loading…
Add table
Add a link
Reference in a new issue