serializer
File: core/src/utcp/interfaces/serializer.py
class Serializer (Generic[T])
Documentation
Abstract interface for serializers.
Defines the contract for serializers that convert objects to and from
Dictionaries For Storage Or Transmission. Serializers Are Responsible For
- Converting objects to dictionaries for storage or transmission
- Converting dictionaries back to objects
- Ensuring data consistency during serialization and deserialization
Methods:
validate_dict(self, obj: dict) -> T
Validate a dictionary and convert it to an object.
Args
obj
: The dictionary to validate and convert.
Returns
The object converted from the dictionary.
to_dict(self, obj: T) -> dict
Convert an object to a dictionary.
Args
obj
: The object to convert.
Returns
The dictionary converted from the object.
copy(self, obj: T) -> T
Create a copy of an object.
Args
obj
: The object to copy.
Returns
A copy of the object.