comet icon indicating copy to clipboard operation
comet copied to clipboard

Support `Send` and serialization/deserialization of `Gc<T>` types

Open segeljakt opened this issue 3 years ago • 3 comments

Would it be possible to implement Send for Gc<T> to allow migration of a Gc<T> pointer from one mutator to another?

In addition, would it be possible to implement serialize/deserialize for Gc<T> types? I mean, instead of converting Gc<T> -> Box<T> -> serialize -> deserialize -> Box<T> -> Gc<T>, I'd like to go Gc<T> -> serialize -> deserialize -> Gc<T>

segeljakt avatar Jan 24 '22 11:01 segeljakt

It is possible to implement Send. Serialize and Deserialize is a harder question to solve, but I know for sure you do not need to box types for serialization and deserialization. In the future Serialize can be implemented, but Deserialize is impossible because we cannot pass mutator to deserialize to allocate memory when needed.

playXE avatar Jan 27 '22 07:01 playXE

I think it's possible to use serde_state. Probably it can be handled by the user

segeljakt avatar Feb 07 '22 13:02 segeljakt

Do you think it's possible to have zero-copy serialization/deserialization using for example rkyv? Maybe it's a long shot.

segeljakt avatar Feb 08 '22 09:02 segeljakt