Companion

Factory helpers for constructing common Codec variants.

Functions

Link copied to clipboard
inline fun <T : Any> identity(name: String): Codec<T, T>

Builds a codec that forwards values without transforming them.

Link copied to clipboard
inline fun <I : Any, O : Any> nullable(name: String, crossinline encoder: (I) -> O, crossinline decoder: (O) -> I?): Codec<I, O>

Builds a codec that tolerates missing values by using a nullable decoding function.

Link copied to clipboard
inline fun <I : Any, O : Any> unsafe(name: String, crossinline encoder: (I) -> O, crossinline decoder: (O) -> I): Codec<I, O>

Builds a codec wrapping potentially unsafe conversion logic.