Skip to main content

CompactTypeEnum

@midnight-ntwrk/compact-runtime v0.9.0


@midnight-ntwrk/compact-runtime / CompactTypeEnum

Class: CompactTypeEnum

Runtime type of an enum with a given number of entries

Implements​

Constructors​

Constructor​

new CompactTypeEnum(maxValue, length): CompactTypeEnum;

Parameters​

maxValue​

number

length​

number

Returns​

CompactTypeEnum

Properties​

length​

readonly length: number;

maxValue​

readonly maxValue: number;

Methods​

alignment()​

alignment(): Alignment;

The field-aligned binary alignment of this type.

Returns​

Alignment

Implementation of​

CompactType.alignment


fromValue()​

fromValue(value): number;

Converts this type's field-aligned binary representation to its TypeScript representation destructively; (partially) consuming the input, and ignoring superflous data for chaining.

Parameters​

value​

Value

Returns​

number

Implementation of​

CompactType.fromValue


toValue()​

toValue(value): Value;

Converts this type's TypeScript representation to its field-aligned binary representation

Parameters​

value​

number

Returns​

Value

Implementation of​

CompactType.toValue