Renamed from
duck-diagnostic(0.7.x). New publishing line:duck-diag0.8+. Old crate stays on crates.io for compatibility.
Install
Optional json feature (default on):
[]
= { = "0.8", = ["json"] }
Quick start
use ;
let d = diag!
.with_label
.with_help;
d.print; // pretty terminal output
let json = d.to_json; // stable JSON shape (with `json` feature)
Module matrix
| path | role |
|---|---|
src/diagnostic.rs |
Diagnostic, Label, Span, Severity, Suggestion, Applicability |
src/formatter.rs |
terminal formatter with caret rendering, color, tab/Unicode-width handling |
src/smart.rs |
multi-file smart printer |
src/compact.rs |
source-less compact rendering + style helpers |
src/json.rs |
stable JSON schema (feature json) |
src/style.rs |
RenderOptions, color toggles, line width clamps |
src/macros.rs |
diag! macro |
Why a generic engine
Most Rust tools (compilers, linters, schema validators, SQL parsers)
want the same diagnostic shape: severity + message + labels + spans +
hints. duck-diag gives you that surface without pulling in
miette, ariadne, or syn. Useful when you want a tiny dep that
ships color + caret rendering without the rest of the world.
Build
Used by
| crate | how |
|---|---|
@gentleduck/md (dmc) |
every layer's diagnostic engine |
| your tool here | open a PR against this README |
Contributing
PR checklist + style notes in CONTRIBUTING.md.
Security: SECURITY.md.
Behaviour: CODE_OF_CONDUCT.md.
License
MIT. See LICENSE.