/** * Runtime support for generic structs/interfaces. Cap'n Proto generics * are erased on the wire (a type parameter is an AnyPointer); bindings * exist only so typed accessors know which concrete struct to read. * * `bindGeneric` specializes a generated generic struct class by * attaching constructor bindings as a static on an anonymous subclass; * generated accessors look their parameter's ctor up via * `getGenericBinding`. Statics (`_capnp` etc.) inherit through the * prototype chain, so a bound subclass is a drop-in `StructCtor`. */ import { Struct, StructCtor } from "./struct"; export declare const BINDINGS: unique symbol; export interface BoundStructCtor extends StructCtor { [BINDINGS]: ReadonlyArray>; } /** * Specialize a generic struct class with concrete parameter constructors * (outermost scope's parameters first). */ export declare function bindGeneric>(Base: C, bindings: ReadonlyArray>): C & BoundStructCtor>; /** * Get the bound constructor for parameter `index` of `struct`'s class, or the * explicit override; throws when the read has no binding to work with. */ export declare function getGenericBinding(struct: Struct, index: number, explicit?: StructCtor): StructCtor;