xRPC-rs
High-performance local IPC library for Rust with seamless transport flexibility.
Start with in-process channels for development, scale to shared memory for production IPC, extend to TCP for network deployment—same interface.
Status: Early prototype - working but not production-ready.
Quick Start
use ;
use ;
use Arc;
// =================== Server
let transport = create_server?;
let channel = new;
let server = new;
server.register_typed;
server.serve.await?;
// =================== Client
let transport = connect_client?;
let channel = new;
let client = new;
let _handle = client.start;
let resp: AddResponse = client.call.await?;
assert_eq!;
Installation
[]
= "0.2"
# Optional codecs: codec-messagepack, codec-cbor, codec-postcard, codec-all
= { = "0.2", = ["codec-messagepack"] }
Status
| Feature | Status |
|---|---|
| FrameTransport Layer (TCP, Unix, SharedMemory, Channel) | Completed |
| MessageChannel with compression | Completed |
| RPC Client/Server | Completed |
| Streaming | Completed |
| Connection Pooling | Completed |
| Batching | Planned |
| Service Discovery & Load Balancing | Planned |
Architecture
xRPC follows a layered architecture:
| Layer | Trait/Module | Description |
|---|---|---|
| Layer 1 | FrameTransport |
Low-level byte transmission with framing |
| Layer 2 | MessageChannel |
Message-aware channel with compression |
| Layer 3 | RpcClient/RpcServer |
RPC with method dispatch, streaming |
| Layer 4 | Advanced | Batching, service discovery, load balancing |
Application
↓
RpcClient/RpcServer (Layer 3)
↓
MessageChannel (Layer 2)
↓
FrameTransport (Layer 1)
↓
Network/IPC
Transport Comparison
| Transport | Use Case | Cross-Process | Serialization |
|---|---|---|---|
SharedMemoryFrameTransport |
Production IPC | Yes | Yes |
TcpFrameTransport |
Network / Remote | Yes | Yes |
UnixFrameTransport |
Local IPC (Unix) | Yes | Yes |
ChannelFrameTransport |
Same-process / Testing | No | Yes |
ArcFrameTransport |
Same-process fast path | No | No (zero-copy) |
Documentation
- Message Protocol - Binary message format specification
Examples
RPC Client/Server
# Terminal 1
# Terminal 2
SharedMemory Transport
# Terminal 1
# Terminal 2
Byte-level Transports
License
MIT License - see LICENSE for details.