decode

inline fun <T> decode(tomlValue: TomlValue): T

Decodes the receiver TOML value to the type indicated by type parameter T using the default TOML decoder. If the value can't be decoded into the target type, a cc.ekblad.toml.model.TomlException.DecodingError is thrown.

When decoding into a data class, all fields of that class must be present in the given TomlValue, except fields that are nullable and/or have a default value. A field which is both nullable and defaulted will be assigned its default value, if missing from the given TomlValue.


fun <T> decode(targetKType: KType, tomlValue: TomlValue): T
fun <T> decode(targetKType: KType, tomlValue: TomlValue, defaultValue: T): T