resizeCodec<TFrom, TTo> function
Updates the size of a given codec using a resize function.
For fixed-size codecs, both the encoder and decoder sizes are updated. For variable-size codecs, only the encoder size is updated.
Throws a SolanaError if the new size is negative.
Implementation
Codec<TFrom, TTo> resizeCodec<TFrom, TTo>(
Codec<TFrom, TTo> codec,
int Function(int size) resize,
) {
return combineCodec(
resizeEncoder(encoderFromCodec(codec), resize),
resizeDecoder(decoderFromCodec(codec), resize),
);
}