import { WriteBuffer, ReadBuffer } from "./buffer"; export declare type EncodeFunc = (buf: WriteBuffer, v: T) => void; export declare type DecodeFunc = (buf: ReadBuffer) => T; export interface Type { readonly enc: EncodeFunc; readonly dec: DecodeFunc; } export interface Collection extends Type { encHeader(buf: WriteBuffer, len: number): void; decHeader(buf: ReadBuffer, expect?: number): number; } export declare type Obj = { [key: string]: T; }; export declare type Field = [string, Type]; export declare type Fields = { readonly [ordinal: number]: Field; }; export interface Branches { readonly [ordinal: number]: Type; ordinalOf(v: any): number; } export declare const Any: Type; export declare const Nil: Type; export declare const Bool: Type; export declare const Int: Type; export declare const Uint: Type; export declare const Float: Type; export declare const Bytes: Type; export declare const Str: Type; export declare const Raw: Type; export declare const Time: Type; export declare const Arr: Collection; export declare const Map: Collection>; export declare function TypedArr(valueT: Type): Collection; export declare function TypedMap(keyT: Type, valueT: Type): Collection>; export declare function structEncoder(fields: Fields): EncodeFunc; export declare function structDecoder(fields: Fields): DecodeFunc; export declare function Struct(fields: Fields): Type>; export declare function unionEncoder(branches: Branches): EncodeFunc; export declare function unionDecoder(branches: Branches): DecodeFunc; export declare function Union(branches: Branches): Type;