PacketIdBindings

class PacketIdBindings[PacketTup <: Tuple](bindings: Map[PacketTup, CodecBinding])(using x$2: Require[ContainsDistinctT[PacketTup]])

An object that associates packet IDs with corresponding datatypes' codec.

PacketTup is a tuple of packets with no duplicates, used in associating codecs. It is also required that bindings should not contain two entries with the same packet ID.

Companion
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def decoderFor(id: PacketId): DecodeFiniteBytes[Union[PacketTup]]

Dynamically resolve the decoder program for a datatype with an associated packet ID of id.

Dynamically resolve the decoder program for a datatype with an associated packet ID of id.

def encode[P](packet: P)(using tei: TupleElementIndex[PacketTup, P]): (PacketId, Chunk[Byte])

Encode the object packet to its binary form and pair the result up with packet id specifying the datatype P.

Encode the object packet to its binary form and pair the result up with packet id specifying the datatype P.