EmperorCookie / accapi

Assetto Corsa Competizione UDP broadcast API wrapper
Apache License 2.0
23 stars 7 forks source link

[Feature Request] Serializable structs #11

Open ptoews opened 3 years ago

ptoews commented 3 years ago

It would be nice if the struct classes could be conveniently serialized to dictionaries, e.g. to transmit the events via json. My suggestion would be a method as_dict() in every struct class, which simply stores its fields as dictionary where references to other classes are serialized to dicts as well.

I could do this in a PR if you like the idea.

EmperorCookie commented 3 years ago

This is part of an improvement I've had in mind where the structs are defined via a declarative language instead of being straight up classes, and this would be one of the primary features.