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.
Type Parameters
Section titled “Type Parameters”Value
Parameters
Section titled “Parameters”values
Section titled “values”readonly Value[]
ElementCodec<Value>
options?
Section titled “options?”InjectiveElementOptions<Value>
Returns
Section titled “Returns”Uint8Array
Throws
Section titled “Throws”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.
Throws
Section titled “Throws”A package error thrown directly by a caller-supplied codec.