RgaOpSerializer

class RgaOpSerializer<V>(vSerializer: KSerializer<V>) : KSerializer<RgaOp<V>>

Custom KSerializer for RgaOp<V> that correctly threads vSerializer through to RgaOp.Insert.value, bypassing the limitation in the compiler-generated sealed-class serializer where the V type parameter defaults to PolymorphicSerializer(Any::class).

Use Rga.serializer (which wraps this) rather than constructing this directly.

Wire format: a CBOR/JSON map with a mandatory t (type discriminator) integer field and variant-specific additional fields:

  • Insert: { "t": 0, "id": RgaId, "v": V, "a": RgaId }

  • Remove: { "t": 1, "id": RgaId }

  • Compact: { "t": 2, "pos": Map<RgaId, RgaId> }

Parameters

vSerializer

the serializer for the element type V.

Constructors

Link copied to clipboard
constructor(vSerializer: KSerializer<V>)

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): RgaOp<V>
Link copied to clipboard
open override fun serialize(encoder: Encoder, value: RgaOp<V>)