Serde (de)serialization support #370
MorganMcmillan
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
Sure, I agree, at least for the structs in three-d-asset. I don't think it makes sense in three-d, most of the structs here is not possible to serialise and deserialise. But I'm not going to do it anytime soon, I simply don't have the time. If you want to do it, please go ahead 🙂 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I would like to suggest adding serde (de)serialization support to Three-d via configurable derive macros.
I am currently aspiring to become a game developer, and really like this crate.
While three-d-asset is able to save some objects, I feel that it is too limited in it's implementation.
My proposal is to make EVERY SINGLE struct (with all public members) and enums serializable by deriving Serialize and Deserialize from serde, insted of being limited to three-d-asset:
structs
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
enums
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(PartialEq,Eq,Hash)]// extra derives for added functionality
The advantages of adding this includes:
saving textures and models in ANY FORMAT: textual(json) or binary(bincode)
saving assets not covered by three-d-asset
personalized debugging
configuring structures without recompiling, using formats like JSON or RON
set settings
sending game state across the net
could be the basis for a cool game engine
among countless others
Insted of one feature flag, I propose giving each module it's own unique flag. EX:
features=["serde-window","serde-renderer","serde-core","serde-context"]
EXAMPLE:
#[cfg_attr(feature = "serde-core", derive(Serialize, Deserialize))] pub struct Vector3\<S> { pub x: S, pub y: S, pub z: S, }
It shouldn't be hard, just time consuming.
Thank you for taking the time to read this, I would love to see serialization support added soon
-morgandotunwrap
Beta Was this translation helpful? Give feedback.
All reactions