@ @repr
@repr(W)
Applies to: type, field
Section: §9.3–9.5
Syntax
Attr = "@" Path [ "(" [ AttrArgs ] ")" ] ;Grammar: App. A
Defined in
- 9.3 The OxL wire format — The OxL binary format is protobuf 3 encoding with the following mappings
- 4.9 Attributes — Syntax: @name or @name(arguments) before a declaration, field, parameter or rpc.
- 9.5 User-defined serialisers — Level 1 — representation through another type (Repr), acts in all formats and in schemas
Examples
@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