Skip to content

encodeInjectiveElements<Value>(values, codec, options?): Uint8Array

Defined in: packages/wire/src/element-codec.ts:59

Encode values as one contiguous codec run, proving the codec injective over them.

Two positions may share an encoding only when equals reports them equal, so a structure whose round trip depends on distinct bytes per stored value fails before an artifact is emitted rather than after it is restored.

Value

readonly Value[]

ElementCodec<Value>

InjectiveElementOptions<Value>

Uint8Array

With INVALID_CODEC_RESULT when a codec throws or returns a non-Uint8Array, NON_INJECTIVE_CODEC when it emits no bytes or repeats bytes across distinct values, and INVALID_ARGUMENT when the run exceeds a representable length.

A package error thrown directly by a caller-supplied codec.