Skip to content

deserializeSegmentedTrieJson<V>(serialized, create?): SegmentedTrie<V>

Defined in: packages/trie/src/serialization/json.ts:201

Rebuild a segmented trie from a SerializedSegmentedTrie, restoring its recorded implementation unless a factory override is supplied. O(k) time for k stored segments.

Entries are replayed in serialized order, so a round trip through serializeSegmentedTrieJson and deserializeSegmentedTrieJson preserves size, iteration order, every stored value, and every longestPrefix answer.

Untyped input produces a SegmentedTrie<unknown>. Pass a value type guard to validate decoded values and recover a narrower value type.

V

SerializedSegmentedTrie<V>

The trie to restore, either statically typed or decoded as unknown.

SegmentedTrieFactory

SegmentedTrie<V>

When the serialized shape, a segment, or a decoded value is invalid, or an entry repeats a key. Distinguish causes with error.code, one of TrieParseErrorCode.

deserializeSegmentedTrieJson<V>(serialized, options): SegmentedTrie<V>

Defined in: packages/trie/src/serialization/json.ts:205

Rebuild a segmented trie from a SerializedSegmentedTrie, restoring its recorded implementation unless a factory override is supplied. O(k) time for k stored segments.

Entries are replayed in serialized order, so a round trip through serializeSegmentedTrieJson and deserializeSegmentedTrieJson preserves size, iteration order, every stored value, and every longestPrefix answer.

Untyped input produces a SegmentedTrie<unknown>. Pass a value type guard to validate decoded values and recover a narrower value type.

V

unknown

The trie to restore, either statically typed or decoded as unknown.

DeserializeSegmentedTrieJsonOptions<V>

SegmentedTrie<V>

When the serialized shape, a segment, or a decoded value is invalid, or an entry repeats a key. Distinguish causes with error.code, one of TrieParseErrorCode.

deserializeSegmentedTrieJson(serialized): SegmentedTrie<unknown>

Defined in: packages/trie/src/serialization/json.ts:209

Rebuild a segmented trie from a SerializedSegmentedTrie, restoring its recorded implementation unless a factory override is supplied. O(k) time for k stored segments.

Entries are replayed in serialized order, so a round trip through serializeSegmentedTrieJson and deserializeSegmentedTrieJson preserves size, iteration order, every stored value, and every longestPrefix answer.

Untyped input produces a SegmentedTrie<unknown>. Pass a value type guard to validate decoded values and recover a narrower value type.

unknown

The trie to restore, either statically typed or decoded as unknown.

SegmentedTrie<unknown>

When the serialized shape, a segment, or a decoded value is invalid, or an entry repeats a key. Distinguish causes with error.code, one of TrieParseErrorCode.