export type Attrs = { [K in keyof T]: TypeDef; }; export type Alignment = 1 | 2 | 4 | 8; export type LayoutElement = { type: "padding"; byteLength: number; } | { type: "field"; name: string; offset: number; typedef: Attrs[keyof Attrs]; }; export type Struct = { type: "struct"; byteLength: number; byteAlign: Alignment; layout: LayoutElement[]; }; export type Num = { type: "i32" | "f32" | "f64" | "uint8" | "uint16" | "uint32" | "int16" | "int32"; byteAlign: Alignment; byteLength: number; T?: T; }; export type Arr = { type: "array"; element: TypeDef; length: number; byteLength: number; byteAlign: Alignment; }; export type TypeDef = Num | Struct | Arr; export declare function array(element: TypeDef, length: number): Arr; export declare const f32: () => TypeDef; export declare const int32: () => TypeDef; export declare const uint8: () => TypeDef; export declare const uint16: () => TypeDef; export declare const uint32: () => TypeDef; export declare function struct(attrs: Attrs): Struct; export declare function offsets(def: Struct): { [K in keyof T]: number; }; export declare function pad(offset: number, alignment: number): number;