UNPKG

molstar

Version:

A comprehensive macromolecular library.

43 lines (42 loc) 1.28 kB
/** * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. * * Taken/adapted from DensityServer (https://github.com/dsehnal/DensityServer) * * @author David Sehnal <david.sehnal@gmail.com> */ /// <reference types="node" /> import { SimpleBuffer } from '../../../mol-io/common/simple-buffer'; export declare type Bool = { kind: 'bool'; }; export declare type Int = { kind: 'int'; }; export declare type Float = { kind: 'float'; }; export declare type Str = { kind: 'string'; }; export declare type Array = { kind: 'array'; element: Element; }; export declare type Prop = { element: Element; prop: string; }; export declare type Obj = { kind: 'object'; props: Prop[]; }; export declare type Element = Bool | Int | Float | Str | Array | Obj; export declare const bool: Bool; export declare const int: Int; export declare const float: Float; export declare const str: Str; export declare function array(element: Element): Array; export declare function obj<T>(schema: ((keyof T) | Element)[][]): Obj; export declare function encode(element: Element, src: any): Buffer; export declare function decode<T>(element: Element, buffer: SimpleBuffer, offset?: number): T;