Define a struct using the functional API.
For Python-like class syntax, use Structure instead.
Object mapping field names to types
Optional
Struct options (e.g. { packed: true })
{ packed: true }
const PointDef = struct({ x: c_int32, y: c_int32 });const buf = PointDef.create({ x: 10, y: 20 });console.log(PointDef.get(buf, 'x')); // 10 Copy
const PointDef = struct({ x: c_int32, y: c_int32 });const buf = PointDef.create({ x: 10, y: 20 });console.log(PointDef.get(buf, 'x')); // 10
Define a struct using the functional API.
For Python-like class syntax, use Structure instead.