Skip to main content

Class: Struct<T>

A type that represents a structure of multiple fields. Similar to an object in JavaScript.

Type Parameters

Type ParameterDescription

T

The type of the structure where each key is a field name and the value is the type of the field.

Implements

Constructors

new Struct()

new Struct<T>(entries: StructTypes<T>): Struct<T>

Creates a new structure type.

Parameters

ParameterTypeDescription

entries

StructTypes<T>

The entries of the structure where each key is a field name and the value is the type of the field.

Returns

Struct<T>

Defined in

types/struct.ts:25

Methods

write()

write(value: T, writer: BufferWriter): void

Writes the structure to the buffer.

Parameters

ParameterTypeDescription

value

T

The structure to write.

writer

BufferWriter

The buffer writer.

Returns

void

Implementation of

BaseType.write

Defined in

types/struct.ts:34


read()

read(reader: BufferReader): T

Reads the structure from the buffer.

Parameters

ParameterTypeDescription

reader

BufferReader

The buffer reader.

Returns

T

The structure read from the buffer.

Implementation of

BaseType.read

Defined in

types/struct.ts:45