| Crates.io | aegean |
| lib.rs | aegean |
| version | 0.6.0 |
| created_at | 2025-06-08 02:28:58.007821+00 |
| updated_at | 2025-06-08 02:28:58.007821+00 |
| description | A fancy diagnostics & reporting crate |
| homepage | |
| repository | https://github.com/gabrielbrunop/aegean |
| max_upload_size | |
| id | 1704554 |
| size | 171,596 |
A fancy compiler diagnostics crate.
aegean is a fork of ariadne with additional features and improvements.
fn main() {
use aegean::{Color, ColorGenerator, Fmt, Label, Report, ReportKind, Source};
let mut colors = ColorGenerator::new();
// Generate & choose some colours for each of our elements
let a = colors.next();
let b = colors.next();
let out = Color::Fixed(81);
Report::build(ReportKind::Error, ("sample.tao", 12..12))
.with_code(3)
.with_message(format!("Incompatible types"))
.with_label(
Label::new(("sample.tao", 32..33))
.with_message(format!("This is of type {}", "Nat".fg(a)))
.with_color(a),
)
.with_label(
Label::new(("sample.tao", 42..45))
.with_message(format!("This is of type {}", "Str".fg(b)))
.with_color(b),
)
.with_label(
Label::new(("sample.tao", 11..48))
.with_message(format!(
"The values are outputs of this {} expression",
"match".fg(out),
))
.with_color(out),
)
.with_note(format!(
"Outputs of {} expressions must coerce to the same type",
"match".fg(out)
))
.finish()
.print(("sample.tao", Source::from(include_str!("sample.tao"))))
.unwrap();
}
See examples/ for more examples.
For each error you wish to report:
Report::build() to create a ReportBuilder.finish method to get a Report.Report, call print or eprint to write the report
directly to stdout or stderr. Alternately, you can use
write to send the report to any other Write destination (such as a file).yansi)ColorGenerator type that generates distinct colours for visual elements."concolor" enables integration with the concolor crate for global color output
control across your application"auto-color" enables concolor's "auto" feature for automatic color controlconcolor's features should be defined by the top-level binary crate, but without any features enabled concolor does
nothing. If aegean is your only dependency using concolor then "auto-color" provides a convenience to enable
concolor's automatic color support detection, i.e. this:
[dependencies]
aegean = { version = "...", features = ["auto-color"] }
is equivalent to this:
[dependencies]
aegean = { version = "...", features = ["concolor"] }
concolor = { version = "...", features = ["auto"] }
The API (should) follow semver. However, this does not apply to the layout of final error messages. Minor tweaks to the internal layout heuristics can often result in the exact format of error messages changing with labels moving slightly. If you experience a change in layout that you believe to be a regression (either the change is incorrect, or makes your diagnostics harder to read) then please open an issue.