Skip to main content

Crate maybe_fatal

Crate maybe_fatal 

Source
Expand description

Potentially fatal diagnostics and diagnostic handling for compilers.

§Usage

See the examples directory for some examples of how to use this crate.

§Relationship to Other Crates

This crate can be thought of as a high-level wrapper around the ariadne crate, as its core functionality is driven by it. It is also kind of a spiritual successor to the rich-err crate I wrote, but to be honest, I totally forgot that existed until I went to publish this one.

There is also the ariadnenum crate, which fulfills a similar purpose to the maybe-fatal-derive crate in this repository. The primary difference is that maybe-fatal-derive was designed specifically for use in the context of this crate, whereas ariadnenum is meant for a workflow that is already using ariadne directly.

One other crate worth mentioning is wurm, which was similarly made for non-fatal error handling. I considered using that crate here, but it made more sense with how I had designed the Diagnostic type to just make my own stuff. Functionality relating to that can be found in the sink module.

§Prerelease Status

This is currently marked as being in beta, as I am still working on making sure the API is as ergonomic and flexible as possible. I would also like to add some more detailed documentation, unit tests, integration tests, and examples.

Modules§

additional_attributes
Additional Attributes
code
Diagnostic codes.
prelude
sink
Types that can act as “sinks” for ClassifiedDiagnostics.
traits
Various traits for working with Diagnostics.

Structs§

ClassifiedDiagnostic
A Diagnostic with an explicit severity.
ColorPalette
A selection of colors to use when building diagnostics.
Config
A type used to configure a report
Diagnostic
A contextualized message meant to assist the user in diagnosing and resolving issues.
Label
A type that represents a labelled section of source code.

Enums§

Context
Some contextual information about a diagnostic.
DiagnosticSeverity
The severity of a Diagnostic.

Derive Macros§

Diagnosederive
Implements Diagnose for a struct with a span and an info field.
DiagnosticGroupderive
Implements DiagnosticGroup for an enum.
DiagnosticInfoWrapperderive
Implements DiagnosticGroup and PartialDiagnose for an enum with newtype variants that also implement DiagnosticGroup and PartialDiagnose.
PartialDiagnosederive
Implements PartialDiagnose for a struct or an enum with struct variants.