Two Flavors
#[check] - Soft constraint. The call succeeds, but you can see if the check passed or failed.
#[assert] - Hard constraint. The call fails if the assertion doesn’t hold.
Check Example
confidence: 1.5, the call still succeeds - you just see passed: false when you inspect the check result.
The label is required for checks. It’s how you identify which constraint passed or failed.
Assert Example
PredictError::Parse error. Label is optional for asserts.
Writing Expressions
Usethis to refer to the field value:
Inspecting Check Results
Usecall_with_meta() to access constraint results:
Handling Assert Failures
When an assert fails, you get aPredictError:
