Ara Reporting

Actions Status Crates.io Docs

Ara reporting is an issue reporting library designed to be used within the Ara compiler.

Internally, Ara reporting uses the codespan-reporting library to build a report of the issues found in the code.

Note If you are planning on adding more features to Ara reporting, please consider adding them to codespan instead if possible.

Usage

Add ara_reporting to your Cargo.toml, and you're good to go!

toml [dependencies] ara_reporting = "0.2.0"

Example

```rust use arareporting::annotation::Annotation; use arareporting::builder::CharSet; use arareporting::builder::ColorChoice; use arareporting::builder::ReportBuilder; use arareporting::error::Error; use arareporting::issue::Issue; use arareporting::source::Source; use arareporting::Report;

fn main() -> Result<(), Error> { let source = Source::inline( r#" $b = match $a { 1 => 2, 2 => 3, default => "string", }; "#, );

let report = Report::new().with_issue(
    Issue::error("E0417", "`match` arms have incompatible types", 6, 61)
        .with_annotation(
            Annotation::new(26, 1).with_message("this is found to be of type `{int}`"),
        )
        .with_annotation(
            Annotation::new(38, 1).with_message("this is found to be of type `{int}`"),
        )
        .with_annotation(
            Annotation::new(56, 8).with_message("expected `{int}`, found `{string}`"),
        )
        .with_note("for more information about this error, try `ara --explain E0417`"),
);

let builder = ReportBuilder::new(source, report)
    .with_colors(ColorChoice::Always)
    .with_char_set(CharSet::Unicode);

builder.print()

} ```

see examples directory for more examples.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Credits