Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

PropertyValue
Identifier namespaceType
Supports repeatno
Supports basetypeyes
Supports conversion typeno
Supports short propertiesno
Supports propertiesyes, see below
Supports subnodesno

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