unsafeTransformTarget
inline fun <Source : Any, Target : Any, Target2 : Any> Codec<Source, Target>.unsafeTransformTarget(crossinline from: (Target2) -> Target, crossinline to: (Target) -> Target2): Codec<Source, Target2>(source)
Builds a new codec by transforming the encoded target type.
Return
a codec that delegates through from and to for encoding and decoding respectively.
Parameters
Source
domain type handled by the original codec.
Target
serialized type emitted by the original codec.
Target2
alternative serialized type emitted by the returned codec.