Key

abstract class Key<T : Any>

A typed key for storing values in a CodecContext.

Keys are compared by identity (reference equality). Define keys as data object or val singletons on your codec object:

object MyCodec : Codec<Foo> {
// Preferred: data object (singleton, IDE-navigable)
data object AllocatorKey : CodecContext.Key<BufferAllocator>()

// Also valid: val with anonymous instance
val MaxSizeKey = object : CodecContext.Key<Int>() {}
}

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
operator override fun equals(other: Any?): Boolean
Link copied to clipboard
override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String