Serialization support for ncollide
- Dominant language
- Rust
- Stars
- 926
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
This issue is related to rustsim/nphysics#203. It is about implementing (de)serialization capabilities to ncollide so they can be used when adding those capabilities to nphysics.
As said in the linked issue I'm willing to make a PR for this myself and I will use this issue to discuss the questions specific to ncollide.
The first thing I did in my temporary fork was adding `#![deny(bare_trait_objects)]` to src/lib.rs and using [cargo fix](https://github.com/rust-lang-nursery/rustfix) to put `dyn` in front of every trait object, thereby making them easily recognisable. This was ~250 changes and originally meant only for development purposes but I think it is sufficiently handy and non-intrusive that it may be a good idea to keep it. If this is done it should most likely be in a different PR to keep changes manageable.
Then I started `derive`-ing the crap out of everything and doing a few manual implementations which only contained `unimplemented!` when I ran into problems. I'm still looking at the problem of trait objects but [typetag](https://crates.io/crates/typetag), as suggested by @Ralith, seems to fix it without security concerns by basically making an enum out of things. I also looked at [serde_traitobject](https://crates.io/crates/serde_traitobject) but that serialized the vtable pointer and could allow arbitrary code execution (I think, about 99% sure and the crate also warns of its insecurity) and is specific to a binary. Question: Is a dependency like typetag acceptable? Otherwise I would end up probably implementing about the same thing but less mature.
I have also looked at the serialization support of some dependencies:
- petgraph supports serialization when using the feature "serde-1"
- nalgebra supports serialization when using the feature "serde-serialize"
- slab does **not** support serialization but has [as of yet unreleased functionality](https://github.com/carllerche/slab/pull/62) which should make it easier and only leave a simple manual implementation left to do.
- smallvec supports serialization but I'm not even sure if it's in use anymore (couldn't find it at least).
I'm currently in the middle of my test week and will resume work on this next weekend, sorry for being a bit slow right now.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.