Skip to main content

Module validated_miette

Module validated_miette 

Source
Expand description

Spanned<T> + garde / validator → miette::Report bridge. Behind the miette Cargo feature; the actual conversion functions are gated on miette + garde or miette + validator. Spanned<T> + garde / validator → miette::Report bridge.

Walks a validation error tree produced by garde::Report or validator::ValidationErrors and emits a single miette::Report whose source label points at the corresponding Spanned<T> range — enabling beautiful, line-and-column-precise output for declarative validation failures.

Behind feature combinations:

  • garde_errors_to_miette requires miette + garde
  • validator_errors_to_miette requires miette + validator

These functions are deliberately free-standing rather than impls on crate::Spanned to keep the dependency surface visible at the call site and avoid leaking miette into every Spanned<T> user.

Functions§

clamped_span
Helper: clamp a span end so it never lands before its start. Exposed for crate::Spanned integrations that compute their own byte range and want to plug straight into a miette source span without re-implementing the clamp.
garde_errors_to_miette
Render a [garde::Report] tree against a Spanned<T> payload as a [miette::Report].
validator_errors_to_miette
Render a [validator::ValidationErrors] against a Spanned<T> payload as a [miette::Report].