Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serde support for World #40

Merged
merged 20 commits into from Jan 9, 2020
Merged

Serde support for World #40

merged 20 commits into from Jan 9, 2020

Conversation

@kabergstrom
Copy link
Contributor

kabergstrom commented Nov 17, 2019

This PR implements support for serde 1.0. Users implement ser::WorldSerializer and de::WorldDeserializer traits, where they have full control over how to serialize ComponentTypeId, TagTypeId, Entity as well as component/tag data.

An example that roundtrips data by serializing, deserializing and then serializing again is provided, whereby the entity-UUID mappings are maintained through the whole process.

Please tell me all the ways in which this is unsound.

I'll squash commits before merge.

kabergstrom added 3 commits Nov 18, 2019
@TomGillen

This comment has been minimized.

Copy link
Owner

TomGillen commented Dec 9, 2019

This looks good, but is there a reason why we can't include much of the code that is in the serde example into the library? It looks like the user would need to write quite a lot of boilerplate code which I don't think most users would implement differently.

@kabergstrom

This comment has been minimized.

Copy link
Contributor Author

kabergstrom commented Dec 9, 2019

We could include the type UUID mappings too, perhaps under a feature flag. The main reason is that users may want to use something other than UUIDs for persistent type identifiers, so I think the current trait API should still be exposed, but we can also include the type UUID implementation as an easy-to-use default?

@MagicRB

This comment has been minimized.

Copy link

MagicRB commented Dec 13, 2019

I too agree with @TomGillen, there is way too much boiler plate imo.

@kabergstrom kabergstrom force-pushed the kabergstrom:serde branch from f6794ba to 688765e Dec 30, 2019
@TomGillen

This comment has been minimized.

Copy link
Owner

TomGillen commented Jan 9, 2020

Sorry for letting this sit for so long. Serialisation as a whole will still need some more work (such as including more of a default setup in-box) before release, but what is implemented here looks good and is behind a non-default feature flag for now anyway.

Other serialisation cases, such as what someone might need for networking, will need further discussion elsewhere as it will likely be quite different to what is implemented in this PR.

@TomGillen TomGillen merged commit 12f754a into TomGillen:master Jan 9, 2020
24 checks passed
24 checks passed
Compile Compile
Details
Compile Compile
Details
Rustfmt
Details
Rustfmt
Details
Clippy
Details
Clippy
Details
Features (--all-features --release) Features (--all-features --release)
Details
Features (--all-features --release) Features (--all-features --release)
Details
Features (--no-default-features --release) Features (--no-default-features --release)
Details
Features (--no-default-features --release) Features (--no-default-features --release)
Details
Features (--all-features) Features (--all-features)
Details
Features (--all-features) Features (--all-features)
Details
Features (--no-default-features) Features (--no-default-features)
Details
Features (--no-default-features) Features (--no-default-features)
Details
Features (--no-default-features --features events) Features (--no-default-features --features events)
Details
Features (--no-default-features --features events) Features (--no-default-features --features events)
Details
Features (--no-default-features --features par-iter) Features (--no-default-features --features par-iter)
Details
Features (--no-default-features --features par-iter) Features (--no-default-features --features par-iter)
Details
Features (--no-default-features --features par-schedule) Features (--no-default-features --features par-schedule)
Details
Features (--no-default-features --features par-schedule) Features (--no-default-features --features par-schedule)
Details
Features (--no-default-features --features metrics) Features (--no-default-features --features metrics)
Details
Features (--no-default-features --features metrics) Features (--no-default-features --features metrics)
Details
Features (--no-default-features --features ffi) Features (--no-default-features --features ffi)
Details
Features (--no-default-features --features ffi) Features (--no-default-features --features ffi)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.