StructType<TDef> Interface
Package: @esfx/struct-type
Represents the constructor for a struct.
Declaration
export interface StructType<TDef extends StructDefinition>
Properties
[InitType]
Declaration
[InitType]: Struct<TDef> | StructObjectInit<TDef> | StructArrayInit<TDef>;
Property Value
[RuntimeType]
Declaration
[RuntimeType]: Struct<TDef>;
Property Value
prototype
Declaration
prototype: Struct<any>;
Property Value
SIZE
Gets the size of this struct, in bytes.
Declaration
readonly SIZE: number;
Property Value
Methods
read(buffer, byteOffset, byteOrder)
Reads a structured value from the buffer. The resulting structured value will be backed by its own buffer.
Declaration
read(buffer: ArrayBufferLike, byteOffset: number, byteOrder?: Endianness): Struct<TDef>;
Parameters
- buffer
- ArrayBufferLike
The ArrayBuffer
or SharedArrayBuffer
from which to read the value.
- byteOrder
- Endianness
The endianness to use when reading the value. If unspecified, the native byte order will be used.
Returns
read(buffer, byteOffset, shared, byteOrder)
Reads a structured value from the buffer. The resulting structured value will be backed by its own buffer.
Declaration
read(buffer: ArrayBufferLike, byteOffset: number, shared?: boolean, byteOrder?: Endianness): Struct<TDef>;
Parameters
- buffer
- ArrayBufferLike
The ArrayBuffer
or SharedArrayBuffer
from which to read the value.
- byteOrder
- Endianness
The endianness to use when reading the value. If unspecified, the native byte order will be used.
Returns
write(buffer, byteOffset, value, byteOrder)
Writes a structured value to a buffer.
Declaration
write(buffer: ArrayBufferLike, byteOffset: number, value: Struct<TDef>, byteOrder?: Endianness): void;
Parameters
- buffer
- ArrayBufferLike
The ArrayBuffer
or SharedArrayBuffer
into which to write the value.
- byteOrder
- Endianness
The endianness to use when writing the value. If unspecified, the native byte order will be used.
Returns