export interface FieldLayout {
    offset: number;
    size: number;
    kind: number;
}
export interface StructLayout {
    size: number;
    fields: FieldLayout[];
}
/** Parse the packed Int32 blob from native `__layoutData()`. */
export declare function parseLayouts(data: Int32Array): StructLayout[];
/** Read a fixed-width C string field; ASCII fast path, gb18030 fallback. */
export declare function readStr(u8: Uint8Array, off: number, size: number): string;
export type Decoder = (view: DataView, u8: Uint8Array, base: number) => Record<string, unknown>;
/** Compile a plain-object decoder for one struct from its layout. */
export declare function buildDecoder(structId: number, layout: StructLayout): Decoder;
/** Build decoders for every struct (lazy callers can also build one at a time). */
export declare function buildAllDecoders(layouts: StructLayout[]): Decoder[];
/**
 * Encode a plain object into a struct's raw bytes (reverse of the decoder).
 * Cold path (requests are infrequent vs ticks), so a simple loop is fine.
 * char[N] string fields reserve a null terminator; single-char fields write 1
 * byte. Request fields are ASCII in practice (ids/codes), so UTF-8 == bytes.
 */
export declare function encodeStruct(layout: StructLayout, fields: {
    js: string;
    kind: number;
}[], obj: Record<string, unknown>, encodeStr?: (s: string) => Uint8Array): Uint8Array;
//# sourceMappingURL=codec.d.ts.map