@rimbu/hashed
Version:
Immutable HashMap and HashSet implementations for TypeScript
38 lines (37 loc) • 1.96 kB
text/typescript
import { RMapBase } from '@rimbu/collection-types/map-custom';
import { Eq } from '@rimbu/common';
import { List } from '@rimbu/list';
import type { HashMap } from '@rimbu/hashed/map';
import type { MapBlockBuilderEntry, MapEntrySet } from '@rimbu/hashed/map-custom';
import { Hasher } from '../../common/index.mjs';
import { HashMapBlock, HashMapCollision, HashMapBlockBuilder } from '@rimbu/hashed/map-custom';
export declare class HashMapContext<UK> extends RMapBase.ContextBase<UK, HashMap.Types> implements HashMap.Context<UK> {
readonly hasher: Hasher<UK>;
readonly eq: Eq<UK>;
readonly blockSizeBits: number;
readonly listContext: List.Context;
readonly blockCapacity: number;
readonly blockMask: number;
readonly maxDepth: number;
readonly _empty: HashMap<any, any>;
readonly _emptyBlock: HashMapBlock<any, any>;
constructor(hasher: Hasher<UK>, eq: Eq<UK>, blockSizeBits: number, listContext: List.Context);
readonly typeTag = "HashMap";
hash(value: UK): number;
getKeyIndex(level: number, hash: number): number;
isNonEmptyInstance(source: any): source is any;
readonly builder: <K extends UK, V>() => HashMap.Builder<K, V>;
createBuilder<K extends UK, V>(source?: HashMap.NonEmpty<K, V>): HashMap.Builder<K, V>;
isValidKey(key: unknown): key is UK;
emptyBlock<V>(): HashMapBlock<UK, V>;
block<V>(entries: (readonly [UK, V])[] | null, entrySets: MapEntrySet<UK, V>[] | null, size: number, level: number): HashMapBlock<UK, V>;
collision<V>(entries: List.NonEmpty<readonly [UK, V]>): HashMapCollision<UK, V>;
isHashMapBlock<K, V>(obj: MapEntrySet<K, V>): obj is HashMapBlock<K, V>;
isHashMapBlockBuilder<K, V>(obj: MapBlockBuilderEntry<K, V>): obj is HashMapBlockBuilder<K, V>;
}
export declare function createHashMapContext<UK>(options?: {
hasher?: Hasher<UK>;
eq?: Eq<UK>;
blockSizeBits?: number;
listContext?: List.Context;
}): HashMap.Context<UK>;