RatioSerializer

object RatioSerializer : KSerializer<Ratio>

Serializes Ratio as its toString string form (e.g. "3 / 10 (30.00%)").

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

String descriptor backing the serialized Ratio.

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): Ratio

Parses a "top / bottom (percent%)" string back into a Ratio, falling back to Ratio.ZERO when malformed.

Link copied to clipboard
open override fun serialize(encoder: Encoder, value: Ratio)

Encodes value using its string form.