chainerror/booksrc/tutorial4.md

17 lines
442 B
Markdown
Raw Normal View History

2018-12-20 16:37:08 +01:00
# Saving coding chars
2018-12-20 15:14:21 +01:00
Because decorating an error with more information should not
let you jump through hoops, `chainerror` has a quick macro for that.
`mstrerror!()` fits right into `.map_err()` letting you quickly add
more debug strings.
`mstrerror!()` even understands `format!()` syntax like `println!()`.
2018-12-20 14:52:06 +01:00
~~~rust
2019-03-04 11:38:35 +01:00
{{#include ../examples/tutorial4.rs}}
2018-12-20 14:52:06 +01:00
# #[allow(dead_code)]
# mod chainerror {
{{#includecomment ../src/lib.rs}}
# }
~~~