Add serde behind feature flag for some builtins by jrockett6 · Pull Request #237 · godot-rust/gdext (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

In godot-rust/gdnative#743, we decided against serializing Rid because it's not a persistent value.

Also, implementing serde support entails more than the derive-macros, namely:

  1. Finding a persisted representation for each type -- this is not always a 1:1 mapping of the struct/enum definition. For example for Projection, should we just store cols or something else?
  2. This would need to be accompanied by tests, serde_json should be enough. Tests also serve as expressive code that visualizes how the persisted format looks.
  3. While this wouldn't need to be implemented right now, it's probably good to think about how to support composite types like Array, PackedArray, Dictionary, Variant.

In general, it may be a bit early to decide all the things already. Some of the interfaces are still changing (including composite types). Also, we'd need to check that this doesn't make our CI run significantly longer; or just enable serde in the Linux unit-test.