Protocol¶
- class laminar.configurations.serde.Protocol¶
Bases:
object
Generic base class for defining ser(de) protocols.
Methods
Serialize a value to a file.
Serialize a value to a byte string.
Compute the hexdigest to generate the content address.
Deserialize a value from a file.
Deserialize a value from a byte stream.
Read a value from a URI with a custom protocol.
Write a value to a URI with a custom protocol.
Attributes
- __init__()¶
- dump(value: Any, file: BinaryIO) None ¶
Serialize a value to a file.
Usage:
with open(..., "wb") as file: Protocol().dump(..., file)
- load(file: BinaryIO) Any ¶
Deserialize a value from a file.
Usage:
with open(..., "rb") as file: Protocol().load(file)