op ..
..
Precedence: 5 Associativity: none
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 — + - * / % ** +% -% % +| -| | & | ^ ~ << >> && || !
- 3.6 Aliases, new types and refined types — distinct T creates a new nominal type with the representation of T.
- 5.5 Pattern matching — A match MUST be exhaustive.
- 4.3 Construction and constructors — Literal. T{ f1: e1, f2, ..base }
Examples
type Bytes2 = [u8; 2] // alias, the same type
type UserId = distinct u64 // a new type, no implicit conversions
type Port = u16 where 1..=65535 // refined type
type Name = str where len(1..=64)
type Email = str where matches(re".+@.+\..+")— 3.6 Aliases, new types and refined types
Related diagnostics
chained-comparison, not-callable, not-overloadable, operator-decl, range-not-iterable, invalid-char, refinement-violated, non-exhaustive, pattern-bindings, unreachable-arm, bad-init, missing-field, must-close, positional-literal