Skip to content

API Reference / @gtkx/runtime / read

Function: read()

read(handle, fieldDescriptor, offset): unknown

Defined in: packages/native/index.d.ts:246

Reads and decodes a value at offset bytes into the handle's memory, using fieldDescriptor to interpret the raw bytes, and rejects a handle that points at nothing rather than reading at the bare offset. A value the descriptor marks as stored inline decodes to a handle aliasing the owner's memory, so writing one of its own fields reaches the owner.

The descriptor is compiled on every call. A field read repeatedly from the same descriptor and offset is cheaper through bindField, which compiles both once.

Parameters

handle

ExternalObject<Handle>

fieldDescriptor

Descriptor

offset

number

Returns

unknown

Released under the MPL-2.0 License.