amethyst/legion

Add solution for serializing/deserializing World as part of a larger type

Rua opened this issue · 0 comments

Rua commented

At the moment, the only way to deserialize a World is through Registry::as_deserialize(_into_world). There are no types that implement Deserialize, which means it's not possible to include a world in a larger struct and implement Deserialize on that. It's possible with a custom #[serde(deserialize_with = "path")] on the struct, but that just shifts the problem.

I realise that part of the issue is how to pass the target World in, since Serde doesn't allow you to pass information in from the outside. That could perhaps be solved using the scoped-tls-hkt crate, or a custom solution like what is used for Entity deserialization.