Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error Reference

Parse Errors

Errors produced during zyn!(...) expansion:

SituationError
{{ }} (empty interpolation)"empty interpolation"
@else not preceded by @if"unexpected @else without @if"
@for (x foo ...) — wrong keyword between binding and iter"expected 'in'"
@element(prop value) — missing = in propsyn parse error
Unrecognized token where expression expectedsyn parse error

Generated Code Errors

SituationError
Pipe Output type not implementing ToTokensRust type error in generated code
Element struct field type mismatch at call siteRust type error in generated code

Attribute Extraction Errors

#[derive(Attribute)] accumulates all validation errors via the Diagnostics type (zyn::Result<T> = Result<T, Diagnostics>):

SituationError
Missing required field"missing required field \name`“withabout` text if available
Type mismatch"expected string literal" etc. from FromArg
Unknown named argument"unknown argument \naem`“with“did you mean `name`?”` if a close match exists (Levenshtein distance ≤ 3)

All errors are collected and returned together as a single Diagnostics value.

Element Diagnostic Macros

#[zyn::element] generates local error!, warn!, note!, help!, and bail! macros that push diagnostics to the element’s diagnostics accumulator. bail! returns early if errors exist. All accept format!-style arguments and an optional ; span = expr suffix. These macros are only available inside #[zyn::element] bodies.

See Diagnostics for usage examples.