chainerror/booksrc/tutorial4.md
Harald Hoyer 4d2d807332 more doc
2018-12-20 16:32:00 +01:00

18 lines
472 B
Markdown

## Saving coding chars
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!()`.
~~~rust
use crate::chainerror::*;
{{#include ../examples/tutorial4.rs:2:}}
# #[allow(dead_code)]
# mod chainerror {
{{#includecomment ../src/lib.rs}}
# }
~~~