Expand description
§ZUS-RS: ZUS RPC Framework for Rust
zus-rs is a high-performance RPC framework with cross-language compatibility
(Rust, Java, C++). It provides service discovery via ZooServer and supports
QuickLZ/Snappy compression.
§Features
- Cross-language RPC: Compatible with Java and C++ implementations
- Protocol Buffer serialization: Efficient binary protocol
- Compression: QuickLZ (default) and Snappy support
- Service Discovery: Integration with ZooServer
- Async I/O: Built on Tokio runtime
- Type-safe: Full Rust type safety with protobuf definitions
§Quick Start
§Client Example
[dependencies]
zus-rs = { version = "1.1.4", features = ["client"] }
tokio = { version = "1.35", features = ["full"] }use zus_rs::prelude::*;
§Server Example
[dependencies]
zus-rs = { version = "1.1.4", features = ["server"] }
tokio = { version = "1.35", features = ["full"] }use zus_rs::prelude::*;
§Protocol Only (No RPC Runtime)
[dependencies]
zus-rs = { version = "1.1.4", features = ["protocol"] }use zus_rs::prelude::*;
// Create protocol message
let request = ZooRegisterClientRequest {};
// Use compression types
let _compressor = Compressor::default();
let _comp_type = CompressionType::QuickLZ;§Feature Flags
Choose the features you need:
| Feature | Description | Includes |
|---|---|---|
default | Client + Server + Protocol | Everything except runtime |
minimal | Protocol definitions only | Just zus-proto |
protocol | Protocol + Codec + Compression | zus-proto, zus-common |
client | RPC client functionality | protocol, zus-rpc-client, zus-discovery |
server | RPC server functionality | protocol, zus-rpc-server, zus-discovery, zus-macros |
full | Everything | client + server |
§Examples
# Just client
[dependencies]
zus-rs = { version = "1.1.4", features = ["client"] }
# Just server
[dependencies]
zus-rs = { version = "1.1.4", features = ["server"] }
# Protocol only (no RPC runtime)
[dependencies]
zus-rs = { version = "1.1.4", features = ["protocol"] }
# Minimal (just message definitions)
[dependencies]
zus-rs = { version = "1.1.4", features = ["minimal"] }
# Everything (default)
[dependencies]
zus-rs = "1.1.4"§Architecture
┌─────────────────────────────────────────┐
│ zus-rs (convenience) │
└─────────────────────────────────────────┘
│
┌───────────┼───────────┐
│ │ │
↓ ↓ ↓
┌────────┐ ┌────────┐ ┌────────┐
│ client │ │ server │ │protocol│
└────────┘ └────────┘ └────────┘
│ │ │
↓ ↓ ↓
┌─────────────────────────────────┐
│ zus-rpc-{client,server} │
│ zus-discovery │
│ zus-common (codec/compression) │
│ zus-proto (protobuf messages) │
└─────────────────────────────────┘§Cross-Language Compatibility
ZUS-RS is wire-compatible with:
- Java: ZUS Java client/server (tested with integration tests)
- C++: ZUS C++ client/server (production-tested)
All implementations share:
- Same 40-byte RPC header format
- Same Protocol Buffer definitions
- Same compression algorithms (QuickLZ, Snappy)
- Same CRC validation (CRC16 header, CRC32 data)
See tests/cross-language/ for comprehensive cross-language test suite.
§Documentation
Re-exports§
pub use zus_proto as proto;pub use zus_common as common;protocolpub use zus_discovery as discovery;clientorserverpub use zus_rpc_client as client;clientpub use zus_rpc_server as server;serverpub use zus_macros;server
Modules§
- prelude
- Commonly used types and traits
Structs§
- Mobile
RpcClient client - Mobile RPC Client (16-byte header protocol)
- Mobile
RpcServer server - Mobile RPC Server (16-byte header protocol)
- RpcClient
client - Convenient type alias for
BaseRpcClient - RpcServer
server - Convenient type alias for
ZusServerManager
Attribute Macros§
- async_
trait clientorserver