Skip to main content

Module mark

Module mark 

Source
Expand description

Types and implementations for marking spans. Diagnostic construction utilities.

The mark module provides free functions returning a [Builder], which accumulates diagnostics and is finalized into an immutable Diagnostic via [Builder::build].

§Quick start

// Single error
return Err(mark::error("field `name` is required").build());

// Accumulator
let d = mark::new()
    .add(mark::error("missing `x`"))
    .add(mark::help("add `x: u32` to your struct"))
    .build();
if d.is_error() { return d.emit(); }

Structs§

Builder
Builder for constructing Diagnostic instances.
Diagnostic
A compiler diagnostic (error, warning, note, or help message).
Walk

Enums§

Level
Diagnostic severity level, ordered from least to most severe.

Traits§

MultiSpan
A type that can be converted into a list of Spans.

Functions§

error
Creates an error diagnostic builder with the given message.
help
Creates a help diagnostic builder with the given message.
new
Creates an empty diagnostic builder.
note
Creates a note diagnostic builder with the given message.
warning
Creates a warning diagnostic builder with the given message.

Type Aliases§

Result
A specialized Result type for zyn diagnostics.