Expand description
Mill-RPC: An Axum-inspired RPC framework built on Mill-IO.
§Quick Start
ⓘ
// Define a service — generates a `calculator` module
mill_rpc::service! {
service Calculator {
fn add(a: i32, b: i32) -> i32;
}
}
// Server side
struct MyCalc;
impl calculator::Service for MyCalc {
fn add(&self, _ctx: &RpcContext, a: i32, b: i32) -> i32 { a + b }
}
// Register
RpcServer::builder()
.service(calculator::server(MyCalc))
.build(&event_loop)?;
// Client side
let client = calculator::Client::new(transport, codec, 0);
client.add(2, 3)?;Re-exports§
Modules§
- client
- RPC Client built on mill-net’s TcpClient.
- prelude
- Convenient re-exports for Mill-RPC users.
- server
- RPC Server built on mill-net’s TcpServer.
Macros§
- service
- Module-level macro for defining an RPC service.
Structs§
- Codec
- Codec for serializing/deserializing RPC payloads.
- Flags
- Bit flags for frame options.
- Frame
- A complete frame (header + payload).
- Frame
Header - Parsed frame header.
- RpcContext
- Context available to RPC handlers during request processing.
- RpcError
- Structured RPC error with status code and message.
Enums§
- Codec
Type - Supported codec types.
- Message
Type - Message types in the wire protocol.
- RpcStatus
- RPC status codes (inspired by gRPC).
Traits§
- RpcTransport
- Trait for client-side RPC transport.
- Service
Dispatch - Trait for dispatching RPC calls to handler methods.