3.0.ipv8.messaging.payload_dataclass

Classes

Functions

Module Contents

3.0.ipv8.messaging.payload_dataclass.type_from_format(fmt: str) TypeVar

Convert a Serializer format directive to a type usable with @dataclass.

class 3.0.ipv8.messaging.payload_dataclass.DataClassPayload(*args: Any, **kwargs)

Bases: 3.0.ipv8.messaging.lazy_payload.VariablePayload

A Payload that is defined as a dataclass.

classmethod __class_getitem__(item: int) DataClassPayloadWID

Syntactic sugar to add a msg_id attribute into the class inheritance structure.


class MyPayload(DataClassPayload[12]):
    pass

assert MyPayload().msg_id == 12
Parameters:

item – The item to get, i.e., the message id