A [syn::Error] wrapper that provides pretty diagnostic messages using [miette].
× expected identifier
╭─[1:1]
1 │
2 │ pub struct {
· ┬
· ╰── expected identifier
3 │ num_yaks: usize
╰────
Usage
let source = r"
pub struct {
num_yaks: usize
}";
let error = .unwrap_err;
let error = new;
let rendered = render; // See miette documentation for usage
println!;
Notably, [Error] properly renders children that have been [syn::Error::combine]-ed:
× duplicate definition of `Foo`
╭─[1:1]
1 │ struct Foo;
· ─┬─
· ╰── initial definition here
2 │ enum Bar {}
3 │ union Foo {}
· ─┬─
· ╰── duplicate definition of `Foo`
╰────