decodeInline

abstract fun decodeInline(descriptor: SerialDescriptor): Decoder(source)

Returns Decoder for decoding an underlying type of a value class in an inline manner. descriptor describes a target value class.

Namely, for the @Serializable @JvmInline value class MyInt(val my: Int), the following sequence is used:

thisDecoder.decodeInline(MyInt.serializer().descriptor).decodeInt()

Current decoder may return any other instance of Decoder class, depending on the provided descriptor. For example, when this function is called on Json decoder with UInt.serializer().descriptor, the returned decoder is able to decode unsigned integers.

Note that this function returns Decoder instead of the CompositeDecoder because value classes always have the single property.

Calling Decoder.beginStructure on returned instance leads to an unspecified behavior and, in general, is prohibited.