msgpack_register_serialization#
- class braintools.file.msgpack_register_serialization(ty, ty_to_state_dict, ty_from_state_dict, override=False)[source]#
Register a type for serialization.
- Parameters:
ty – the type to be registered
ty_to_state_dict – a function that takes an instance of ty and returns its state as a dictionary.
ty_from_state_dict – a function that takes an instance of ty and a state dict, and returns a copy of the instance with the restored state.
override (
bool) – override a previously registered serialization handler (default: False).