chainerror/booksrc/tutorial12.md

12 lines
280 B
Markdown
Raw Normal View History

2019-02-01 11:40:46 +01:00
# Deref for the ErrorKind
2019-02-03 19:33:26 +01:00
Because ChainError<T> implements Deref to &T, we can also match on `*e` instead of `e.kind()`
or call a function with `&e`
2019-02-01 11:40:46 +01:00
~~~rust
2019-03-04 11:38:35 +01:00
{{#include ../examples/tutorial12.rs}}
2019-02-01 11:40:46 +01:00
# #[allow(dead_code)]
# mod chainerror {
{{#includecomment ../src/lib.rs}}
# }
~~~