commonMain.com.caesarealabs.rpc4k.runtime.api.SerializationFormat.kt Maven / Gradle / Ivy
The newest version!
package com.caesarealabs.rpc4k.runtime.api
import com.caesarealabs.rpc4k.runtime.implementation.serializers.*
import io.ktor.http.*
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.SerializationStrategy
import kotlinx.serialization.json.Json
/**
* For example [Json] or Protobuf
* Must use the [Rpc4kSerializersModule]
*/
public interface SerializationFormat {
public fun encode(serializer: SerializationStrategy, value: T): ByteArray
public fun decode(serializer: DeserializationStrategy, raw: ByteArray): T
public val contentType: ContentType
}