s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
48 lines • 1.48 kB
TypeScript
import type { Uint64Cell } from '../../dataStructures/uint64';
/** The kind of input required to store a vector for proper indexing */
export interface VectorKey {
cell: Uint64Cell;
}
/** Represents a vector store or an array */
export interface VectorStore<V> {
push: (value: V) => void;
get: (index: number) => Promise<V>;
length: number;
values: () => AsyncGenerator<V>;
sort: (() => void) | (() => Promise<void>);
[Symbol.asyncIterator]: () => AsyncGenerator<V>;
close: () => void;
}
/** A constructor for a vector store */
export type VectorStoreConstructor<V extends VectorKey> = new () => VectorStore<V>;
/** A local vector key-value store */
export declare class Vector<V extends VectorKey> implements VectorStore<V> {
#private;
/**
* Push a value into the store
* @param value - the value to store
*/
push(value: V): void;
/**
* @param index - the position in the store to get the value from
* @returns the value
*/
get(index: number): Promise<V>;
/** @returns the length of the store */
get length(): number;
/**
* iterate through the values
* @yields an iterator
*/
values(): AsyncGenerator<V>;
/** Sort the store in place */
sort(): void;
/**
* iterate through the values
* @returns an iterator
*/
[Symbol.asyncIterator](): AsyncGenerator<V>;
/** Closes the store */
close(): void;
}
//# sourceMappingURL=index.d.ts.map