Expand description
tarpc transport codec for RYO RPC communication.
§Why MessagePackNamed?
RYO uses MessagePack for RPC serialization via tarpc. There are two serialization modes:
| Mode | Serialization | skip_serializing_if |
|---|---|---|
| Array-based (default) | [value1, value2, ...] | Incompatible |
| Named (map-based) | {"field1": value1, ...} | Compatible |
Many response types use #[serde(skip_serializing_if = "...")] to reduce payload size.
This requires named serialization where fields are identified by name, not position.
Using array-based serialization with skip_serializing_if causes deserialization failures:
invalid type: boolean `false`, expected a sequence§Usage
Always use the helper functions to create transports:
ⓘ
use ryo_app::codec::create_client_transport;
use tokio::net::UnixStream;
let stream = UnixStream::connect(socket_path).await?;
let transport = create_client_transport(stream);
let client = RyoServiceClient::new(config, transport).spawn();§Important
DO NOT use tokio_serde::formats::MessagePack::default() directly.
It uses array-based serialization which is incompatible with skip_serializing_if.
Structs§
- Message
Pack Named - MessagePack codec with named (map-based) serialization.
Functions§
- create_
client_ transport - Create a tarpc transport with the correct codec for client-side use.
- create_
server_ transport - Create a tarpc transport with the correct codec for server-side use.