@@ -11,11 +11,13 @@ import kotlinx.serialization.cbor.*
1111import kotlinx.serialization.descriptors.*
1212import kotlinx.serialization.encoding.*
1313
14+ internal interface CborSerializer
15+
1416/* *
1517 * Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborElement].
1618 * It can only be used by with [Cbor] format and its input ([CborDecoder] and [CborEncoder]).
1719 */
18- internal object CborElementSerializer : KSerializer<CborElement> {
20+ internal object CborElementSerializer : KSerializer<CborElement>, CborSerializer {
1921 override val descriptor: SerialDescriptor =
2022 buildSerialDescriptor(" kotlinx.serialization.cbor.CborElement" , PolymorphicKind .SEALED ) {
2123 // Resolve cyclic dependency in descriptors by late binding
@@ -52,7 +54,7 @@ internal object CborElementSerializer : KSerializer<CborElement> {
5254 * Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborPrimitive].
5355 * It can only be used by with [Cbor] format an its input ([CborDecoder] and [CborEncoder]).
5456 */
55- internal object CborPrimitiveSerializer : KSerializer<CborPrimitive<*>> {
57+ internal object CborPrimitiveSerializer : KSerializer<CborPrimitive<*>>, CborSerializer {
5658 override val descriptor: SerialDescriptor =
5759 buildSerialDescriptor(" kotlinx.serialization.cbor.CborPrimitive" , PolymorphicKind .SEALED )
5860
@@ -79,7 +81,7 @@ internal object CborPrimitiveSerializer : KSerializer<CborPrimitive<*>> {
7981 * Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborNull].
8082 * It can only be used by with [Cbor] format an its input ([CborDecoder] and [CborEncoder]).
8183 */
82- internal object CborNullSerializer : KSerializer<CborNull> {
84+ internal object CborNullSerializer : KSerializer<CborNull>, CborSerializer {
8385
8486 override val descriptor: SerialDescriptor =
8587 buildSerialDescriptor(" kotlinx.serialization.cbor.CborNull" , SerialKind .ENUM )
@@ -102,7 +104,7 @@ internal object CborNullSerializer : KSerializer<CborNull> {
102104}
103105
104106
105- internal object CborIntSerializer : KSerializer<CborInt<*>> {
107+ internal object CborIntSerializer : KSerializer<CborInt<*>>, CborSerializer {
106108 override val descriptor: SerialDescriptor =
107109 PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborInt" , PrimitiveKind .LONG )
108110
@@ -120,7 +122,7 @@ internal object CborIntSerializer : KSerializer<CborInt<*>> {
120122 }
121123}
122124
123- internal object CborNegativeIntSerializer : KSerializer<CborNegativeInt> {
125+ internal object CborNegativeIntSerializer : KSerializer<CborNegativeInt>, CborSerializer {
124126 override val descriptor: SerialDescriptor =
125127 PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborNegativeInt" , PrimitiveKind .LONG )
126128
@@ -136,7 +138,7 @@ internal object CborNegativeIntSerializer : KSerializer<CborNegativeInt> {
136138 }
137139}
138140
139- internal object CborPositiveIntSerializer : KSerializer<CborPositiveInt> {
141+ internal object CborPositiveIntSerializer : KSerializer<CborPositiveInt>, CborSerializer {
140142 override val descriptor: SerialDescriptor =
141143 PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborPositiveInt" , PrimitiveKind .LONG )
142144
@@ -152,7 +154,7 @@ internal object CborPositiveIntSerializer : KSerializer<CborPositiveInt> {
152154 }
153155}
154156
155- internal object CborDoubleSerializer : KSerializer<CborDouble> {
157+ internal object CborDoubleSerializer : KSerializer<CborDouble>, CborSerializer {
156158 override val descriptor: SerialDescriptor =
157159 PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborDouble" , PrimitiveKind .DOUBLE )
158160
@@ -172,7 +174,7 @@ internal object CborDoubleSerializer : KSerializer<CborDouble> {
172174 * Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborString].
173175 * It can only be used by with [Cbor] format an its input ([CborDecoder] and [CborEncoder]).
174176 */
175- internal object CborStringSerializer : KSerializer<CborString> {
177+ internal object CborStringSerializer : KSerializer<CborString>, CborSerializer {
176178 override val descriptor: SerialDescriptor =
177179 PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborString" , PrimitiveKind .STRING )
178180
@@ -194,7 +196,7 @@ internal object CborStringSerializer : KSerializer<CborString> {
194196 * Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborBoolean].
195197 * It can only be used by with [Cbor] format an its input ([CborDecoder] and [CborEncoder]).
196198 */
197- internal object CborBooleanSerializer : KSerializer<CborBoolean> {
199+ internal object CborBooleanSerializer : KSerializer<CborBoolean>, CborSerializer {
198200 override val descriptor: SerialDescriptor =
199201 PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborBoolean" , PrimitiveKind .BOOLEAN )
200202
@@ -216,7 +218,7 @@ internal object CborBooleanSerializer : KSerializer<CborBoolean> {
216218 * Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborByteString].
217219 * It can only be used by with [Cbor] format and its input ([CborDecoder] and [CborEncoder]).
218220 */
219- internal object CborByteStringSerializer : KSerializer<CborByteString> {
221+ internal object CborByteStringSerializer : KSerializer<CborByteString>, CborSerializer {
220222 override val descriptor: SerialDescriptor =
221223 PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborByteString" , PrimitiveKind .STRING )
222224
@@ -238,7 +240,7 @@ internal object CborByteStringSerializer : KSerializer<CborByteString> {
238240 * Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborMap].
239241 * It can only be used by with [Cbor] format and its input ([CborDecoder] and [CborEncoder]).
240242 */
241- internal object CborMapSerializer : KSerializer<CborMap> {
243+ internal object CborMapSerializer : KSerializer<CborMap>, CborSerializer {
242244 private object CborMapDescriptor :
243245 SerialDescriptor by MapSerializer (CborElementSerializer , CborElementSerializer ).descriptor {
244246 @ExperimentalSerializationApi
@@ -263,7 +265,7 @@ internal object CborMapSerializer : KSerializer<CborMap> {
263265 * Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborList].
264266 * It can only be used by with [Cbor] format an its input ([CborDecoder] and [CborEncoder]).
265267 */
266- internal object CborListSerializer : KSerializer<CborList> {
268+ internal object CborListSerializer : KSerializer<CborList>, CborSerializer {
267269 private object CborListDescriptor : SerialDescriptor by ListSerializer(CborElementSerializer ).descriptor {
268270 @ExperimentalSerializationApi
269271 override val serialName: String = " kotlinx.serialization.cbor.CborList"
0 commit comments