ProtocolMessage

@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class ProtocolMessage

Marks a data class or sealed interface as a protocol message. KSP will generate a Codec implementation for this type at compile time.

@ProtocolMessage
data class SensorReading(
val sensorId: UShort, // 2 bytes
val temperature: Int, // 4 bytes
)
// Generates SensorReadingCodec with decode(), encode(), and sizeOf()

Note: Generated code appears after compilation (./gradlew build). IDE features (autocomplete, navigation) for generated codecs require an initial build.