encodeEnum

open override fun encodeEnum(enumDescriptor: SerialDescriptor, index: Int)(source)

Encodes a enum value that is stored at the index in enumDescriptor elements collection. Corresponding kind is SerialKind.ENUM.

E.g. for the enum enum class Letters { A, B, C, D } and serializable value "C", encodeEnum method should be called with 2 as am index.

This method does not imply any restrictions on the output format, the format is free to store the enum by its name, index, ordinal or any other