OxL Reference

@ @repr

@repr(W)

Applies to: type, field

Section: §9.3–9.5

Syntax

ebnf
Attr        = "@" Path [ "(" [ AttrArgs ] ")" ] ;

Grammar: App. A

Defined in

Examples

oxl
@repr(i64)
data Money { minor: i64 }

impl Repr<i64> for Money {
  fn toRepr() -> i64 => minor
  static fn fromRepr(v: i64) -> Money | DecodeError => Money{ minor: v }
}

— 9.5 User-defined serialisers

Related diagnostics

secret-json, deprecated, schema-attr

See also