Conversation
|
hey @RenzoMXD thank you for this PR! I really want to get this in but given I have so little experience in rust it may take a bit for me to digest and feel confident in this being a solution. I hope you will have patience with me :D @fawdlstty would you be able to test this against your original issues? |
|
Thank you very much for your help. The generated object API is something I didn't notice, but it can indeed solve this problem. |
|
@jtdavis777 If possible, I suggest not waiting for my local testing as I may only get involved in this part after a while and not too quickly |
|
Run the deserialize-specific test:
Expected Output: The new tests live in
I think this can help your testing @jtdavis777 |
Summary
Closes #8841
Adds
serde::Deserializesupport for the Rust Object API types, enabling full JSON (and any serde format) round-trip serialization/deserialization.Problem
The Rust FlatBuffers target supported:
Serialize(--rust-serialize)*Ttypes viaunpack()/pack()(--gen-object-api)But it was missing the reverse path: deserializing JSON (or any text/binary serde format) back into Rust types. The core challenge identified in #8841 was that serde's
Deserializetrait signature doesn't accept aFlatBufferBuilder, making it impossible to deserialize directly into the zero-copy reader types.Solution
Instead of targeting the zero-copy reader types (
Monster<'a>), this PR addsDeserializeto the Object API types (MonsterT,Vec3T, etc.) which own their data (String,Vec,Box) and can be freely constructed without a builder. This gives users a complete round-trip path: