deserialize_bytes and deserialize_byte_buf support for custom deserializers#63
Open
luca992 wants to merge 3 commits into
Open
deserialize_bytes and deserialize_byte_buf support for custom deserializers#63luca992 wants to merge 3 commits into
luca992 wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I would like to be able to use my own deserializer to parse the raw bytes in my own project. This would allow me to do things like being able to deserialize untagged enums without needing to use serde_cw_value which increases my wasm size by about 200kb :/ ....
Here's an example where I am able to deserialize an untagged enum #43 by trial and error since I have access to the raw bytes.
https://github.com/eqoty-labs/snip721-migratable/blob/0fc9028f497d2e5393d55209b9a49d24cea8d15a/contracts/snip721-migratable/src/msg_untagged_deserializer.rs
There very could be a better way to do this, but this is the best solution I have come up so far.
Plus giving people the ability to write custom deserializers with access to the raw bytes opens the door for other message serialization formats other than json.