Extern
An extern allows users to provide their own custom types and use them as conversion types.
The extern must be available to the generated code with the name directly. No namespacing is applied.
By default extern types can only used fallibly and will have the bit size of the base type.
Example
/// doc comment line
extern Example -> uint {
infallible: allow,
size-bits: 8,
}
Table
| Property | Value |
|---|---|
| Identifier namespace | Type |
| Supports repeat | no |
| Supports basetype | yes |
| Supports conversion type | no |
| Supports short properties | no |
| Supports properties | yes, see below |
| Supports subnodes | no |
Long properties
These properties are specified in the node body.
infallible
Allows this type to be infallably converted to.
// allow
infallible: allow
Info
- required:
no - multiple allowed:
no - supports doc comments:
no
size-bits
The size of the type in bits.
// number
size-bits: 8
Info
- required:
no - multiple allowed:
no - supports doc comments:
no