commonMain.com.huanshankeji.kotlinx.serialization.Serializers.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-common-serialization-jvm Show documentation
Show all versions of kotlin-common-serialization-jvm Show documentation
Huanshankeji's common code libraries in Kotlin
The newest version!
package com.huanshankeji.kotlinx.serialization
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.descriptors.buildClassSerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
// see: https://github.com/Kotlin/kotlinx.serialization/issues/614, https://github.com/Kotlin/kotlinx.serialization/issues/932
internal fun throwIse(): Nothing =
throw IllegalStateException()
@Deprecated("A workaround Nothing serializer doesn't work for the JS target.")
object NothingSerializer : KSerializer {
override val descriptor: SerialDescriptor
get() = buildClassSerialDescriptor("Nothing") {}
override fun serialize(encoder: Encoder, value: Nothing) =
throwIse()
override fun deserialize(decoder: Decoder): Nothing =
throwIse()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy