decodeEnum

abstract fun decodeEnum(enumDescriptor: SerialDescriptor): Int(source)

Decodes a enum value and returns its index in enumDescriptor elements collection. Corresponding kind is SerialKind.ENUM.

E.g. for the enum enum class Letters { A, B, C, D } and underlying input "C", decodeEnum method should return 2 as a result.

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