OxL Reference

op ..

..

Precedence: 5   Associativity: none

Defined in

Examples

oxl
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

See also