Payloads
The two containers an Operation and a Reply carry their data in.
hololinked.core.eventloop.payloads.SerializableData
dataclass
A container for data that can be serialized.
Either provide a serializer or a content type to pick a suitable already supported serializer.
Source code in repo/hololinked/hololinked/core/eventloop/payloads.py
Attributes
Functions
__init__
__init__(value: Any, serializer: BaseSerializer | None = None, content_type: str = 'application/json', _serialized: bytes | None = None) -> None
serialize
Serialize the value.
Returns:
| Type | Description |
|---|---|
bytes
|
serialized value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no suitable serializer is found for the content type. |
Source code in repo/hololinked/hololinked/core/eventloop/payloads.py
deserialize
Deserialize the value.
Returns:
| Type | Description |
|---|---|
Any
|
deserialized value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no suitable serializer is found for the content type. |
Source code in repo/hololinked/hololinked/core/eventloop/payloads.py
require_serialized
Ensure the value is serialized. Can raise ValueError if no suitable serializer is found.
hololinked.core.eventloop.payloads.PreserializedData
dataclass
A container for data that is already serialized.
The content type is only a metadata here. The value is expected to be bytes.