Skip to main content

Module validate

Module validate 

Source
Expand description

IDL validation. This module owns the ValidationError catalog and the validate entry point, which checks an Api against the library’s Identity and builds the one Model every generator consumes. The work is split across submodules: rules (name, type, and shape checks), diagnostic (miette span attachment), and warnings (advisory lints).

Validation collects every rule violation before failing, so a document with several problems reports them all in one run rather than one per invocation.

Structs§

Options
Options for validate_scoped.
ValidationDiagnostic
Diagnostic wrapper that attaches an optional source code snippet and a best-effort byte range to a ValidationError for fancy rendering via miette. The wrapper delegates help() and code() to the inner error while exposing its own source_code and labels so the renderer can underline the offending identifier in the input.
ValidationDiagnostics
Every validation failure found in one pass, each wrapped as a ValidationDiagnostic carrying an optional source span.

Enums§

ValidationError
Every way an Api can fail validation.
ValidationWarning
A non-fatal advisory emitted by collect_warnings.

Functions§

collect_warnings
Walk every module (including nested submodules) and collect all advisory warnings for api.
validate
Validate an Api document against the library’s identity, reporting every rule violation found, and build its Model.
validate_scoped
Validate api against identity exactly like validate, with options, returning each violation with the declaration path that encloses it instead of a located diagnostic.

Type Aliases§

Found
A rule violation paired with the declaration path that encloses it (module segments, then the declaration, member, and parameter or field names). validate uses the path to locate the offending IDL text; the #[weaveffi::module] macro uses it to find the offending Rust item.