Toml Encoder
Describes how Kotlin model types are encoded into TomlValues. This API closely mirrors that of TomlDecoder.
If you intend to both encode and decode TOML, can get by with custom mappings, and don't need the full power of custom encoding functions, you should probably use TomlTranscoder instead.
Types
Functions
Returns a copy of the target TOML encoder, extended with zero or more additional custom encoder functions. A custom encoder function is a function from some Kotlin value to a TomlValue. Custom encoder functions are associated with a KClass representing the source type.
Returns a copy of the receiver TOML encoder extended with a single custom encoder function, without having to manually specify its target type.
Returns a copy of the receiver TOML encoder, extended with a custom property mapping for the type T
. Mappings are given on the form "kotlinName" to "tomlName"
.
Returns a copy of the receiver TOML encoder, extended with a custom property mapping for the type indicated by the given KClass
. Mappings are given on the form "kotlinName" to "tomlName"
.
Extensions
Encodes the given Kotlin value to as into a TomlValue using the receiver TomlEncoder. If the value can't be encoded, a TomlException.EncodingError is thrown.