decode

inline fun <T> TomlMapper.decode(string: String): T

Parses the given TOML-formatted string into a TOML document and decodes it into the given type T.

If the string does not contain a valid TOML document, a TomlException.ParseError is thrown. If the resulting TOML document can not be decoded into the type T, a TomlException.DecodingError is thrown.


inline fun <T> TomlMapper.decode(stream: InputStream): T

Parses the given TOML-formatted input stream into a TOML document and decodes it into the given type T.

If the string does not contain a valid TOML document, a TomlException.ParseError is thrown. If the resulting TOML document can not be decoded into the type T, a TomlException.DecodingError is thrown.


inline fun <T> TomlMapper.decode(path: Path): T

Parses the given TOML-formatted file into a TOML document and decodes it into the given type T.

If the string does not contain a valid TOML document, a TomlException.ParseError is thrown. If the resulting TOML document can not be decoded into the type T, a TomlException.DecodingError is thrown.