op ?
?
Defined in
- 5.2 Precedence and associativity — Precedence and associativity
- 5.3 Overloading and user-defined operators — Overloading built-in operators — op declarations in impl
- 1.6 Operators and delimiters — + - * / % ** +% -% % +| -| | & | ^ ~ << >> && || !
- 4.3 Construction and constructors — Literal. T{ f1: e1, f2, ..base }
- 6.5 Errors — There are no exceptions.
- 1.2 Statement termination — A statement is terminated by ; or by a line break.
Examples
@error data NotFound { what: str }
@error enum PayError { Declined(reason: str), Fraud }
fn charge(card: Card, sum: Money) -> Receipt | PayError | NetError net {
let token = Vault.tokenize(card)? // ? propagates the errors of the call
if sum <= Money.zero() { fail PayError.Declined("zero sum") }
Bank.pay(token, sum)
}Related diagnostics
chained-comparison, not-callable, not-overloadable, operator-decl, range-not-iterable, invalid-char, bad-init, missing-field, must-close, positional-literal, sealed-literal, fail-type, question-context, unhandled-error