@tamgl/colyseus-schema
Version:
Binary state serializer with delta encoding for games
61 lines (60 loc) • 3.08 kB
TypeScript
/**
* Copyright (c) 2018 Endel Dreyer
* Copyright (c) 2014 Ion Drive Software Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE
*/
import type { Iterator } from "./decode";
export type BufferLike = number[] | ArrayBufferLike;
declare function utf8Write(view: BufferLike, str: string, it: Iterator): void;
declare function int8(bytes: BufferLike, value: number, it: Iterator): void;
declare function uint8(bytes: BufferLike, value: number, it: Iterator): void;
declare function int16(bytes: BufferLike, value: number, it: Iterator): void;
declare function uint16(bytes: BufferLike, value: number, it: Iterator): void;
declare function int32(bytes: BufferLike, value: number, it: Iterator): void;
declare function uint32(bytes: BufferLike, value: number, it: Iterator): void;
declare function int64(bytes: BufferLike, value: number, it: Iterator): void;
declare function uint64(bytes: BufferLike, value: number, it: Iterator): void;
declare function bigint64(bytes: BufferLike, value: bigint, it: Iterator): void;
declare function biguint64(bytes: BufferLike, value: bigint, it: Iterator): void;
declare function float32(bytes: BufferLike, value: number, it: Iterator): void;
declare function float64(bytes: BufferLike, value: number, it: Iterator): void;
declare function boolean(bytes: BufferLike, value: number, it: Iterator): void;
declare function string(bytes: BufferLike, value: string, it: Iterator): number;
declare function number(bytes: BufferLike, value: number, it: Iterator): 1 | 2 | 3 | 5 | 9;
export declare const encode: {
int8: typeof int8;
uint8: typeof uint8;
int16: typeof int16;
uint16: typeof uint16;
int32: typeof int32;
uint32: typeof uint32;
int64: typeof int64;
uint64: typeof uint64;
bigint64: typeof bigint64;
biguint64: typeof biguint64;
float32: typeof float32;
float64: typeof float64;
boolean: typeof boolean;
string: typeof string;
number: typeof number;
utf8Write: typeof utf8Write;
utf8Length: (str: string, _?: any) => number;
};
export {};