wormhole/sdk/rust/serde_wormhole/src
Chirantan Ekbote 3c6702b6f7 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.
2023-01-18 09:29:05 +09:00
..
de.rs sdk/rust: Add serde_wormhole::RawMessage 2023-01-18 09:29:05 +09:00
error.rs sdk/rust: Add serde_wormhole crate 2022-12-14 16:33:22 +09:00
lib.rs sdk/rust: Add serde_wormhole::RawMessage 2023-01-18 09:29:05 +09:00
raw.rs sdk/rust: Add serde_wormhole::RawMessage 2023-01-18 09:29:05 +09:00
ser.rs sdk/rust: Add serde_wormhole::RawMessage 2023-01-18 09:29:05 +09:00