Map of field ID to RelishValue for each field
RelishStruct value
import { Struct, String_, U32, encode } from '@grounds/core';
const person = Struct(new Map([
[0, String_('Alice')], // field 0: name
[1, U32(30)] // field 1: age
]));
encode(person).match(
(bytes) => console.log('Struct encoded:', bytes),
(error) => console.error(error)
);
Creates a struct Relish value.
A struct is a heterogeneous collection of named fields, each with a numeric field ID (0-127) and a RelishValue. Fields are encoded in ascending ID order.