Registry / utility / annotate-snippets

annotate-snippets

JSON →
library0.12.16rscratesunverified

Formats diagnostic reports with highlighted source code snippets for better error messages.

# Cargo.toml [dependencies] annotate-snippets = "0.12.16"
INSTALL
IMPORT
SIG · ANNOTATE-SNIPPETS
A
annotate-snippets
utilityrustv0.12.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Renderer
use annotate_snippets::Renderer;

Renders a diagnostic snippet with an error annotation.

use annotate_snippets::{Renderer, Snippet, Level}; let snippet = Snippet::source("fn main() {\n let x = 1;\n println!(\"{} \", x);\n}") .line_start(1) .fold(true) .annotation(Level::Error.span(2, 12).label("expected `;`")); let renderer = Renderer::styled(); println!("{}", renderer.render(snippet));
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.12.16latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
18
Amazon
1
OpenAI (training)
1
Resources
annotate-snippets — cargo add annotate-snippets · libregistry