Package-level declarations

Types

Link copied to clipboard
annotation class LengthFrom(val field: String)

Marks a String field whose byte length is determined by a preceding numeric field. The referenced field must exist, come before this field, and be a numeric type.

Link copied to clipboard

Length prefix encoding for LengthPrefixed fields. All variants use big-endian (network) byte order.

Link copied to clipboard
annotation class LengthPrefixed(val prefix: LengthPrefix = LengthPrefix.Short)

Marks a String or payload field as length-prefixed: prefix bytes followed by UTF-8 data. Default is 2-byte big-endian (UShort) prefix.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class PacketType(val value: Int)

Specifies the discriminator value for a variant of a @ProtocolMessage sealed interface.

Link copied to clipboard
annotation class Payload

Marks a type parameter as the application payload. The generated codec will provide a scoped PayloadReader for decoding.

Link copied to clipboard
@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.

Link copied to clipboard
annotation class RemainingBytes

Marks a String field to consume all remaining bytes as UTF-8. Must be the last non-conditional field in the constructor.

Link copied to clipboard
annotation class WhenTrue(val expression: String)

Conditional field: only present on the wire when the referenced expression is true. The field must be nullable with a default value of null.

Link copied to clipboard
annotation class WireBytes(val value: Int)

Overrides the wire width of a numeric field. The value specifies the number of bytes on the wire (1-8). Must not exceed the Kotlin type's natural size. Cannot be used on Float, Double, or Boolean.