3c6702b6f7
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. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |