forked from wormhole-foundation/wormhole
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sdk/rust: Add serde_wormhole::RawMessage
Add a RawMessage type that can be used to defer parsing parts of a payload, similar to the `json.RawMessage` from Go. The implementation is inspired by `serde_json::RawValue`, which does a similar thing. When serializing, RawMessage will serialize to a base64-encoded string if it detects that the data format is human readable (like JSON). Otherwise it will simply forward the raw bytes to the serializer. RawMessage has both borrowed and boxed versions. The borrowed version is the most efficient as it enables zero-copy handling of the input data but also requires that the input data already contains raw bytes and is not suitable when dealing with human-readable formats like JSON. The boxed version is more flexible as it supports byte slices, base64- encoded strings, and byte sequences but is slightly less efficient as it requires copying or decoding the input data.
- Loading branch information
1 parent
8f08d68
commit 3c6702b
Showing
7 changed files
with
688 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.