Expand description
§oxirpc — Pure-Rust gRPC stack
oxirpc is a facade over tonic that provides
ergonomic re-exports, native gRPC primitives, and COOLJAPAN Pure-Rust defaults
(no ring, no openssl, no native-tls on default features).
§Quick start
Add to your Cargo.toml:
[dependencies]
oxirpc = { version = "0.1", features = ["client", "server", "tls"] }Add to your build.rs:
ⓘ
fn main() -> Result<(), Box<dyn std::error::Error>> {
oxirpc_build::compile_protos(&["proto/service.proto"], &["proto/"])?;
Ok(())
}// Client side
async fn run_client() -> Result<(), oxirpc::OxiRpcError> {
let _channel = oxirpc::ClientBuilder::new("http://127.0.0.1:50051")
.connect()
.await?;
// let client = MyServiceClient::new(_channel); // generated client
Ok(())
}§Feature flags
| Feature | What it enables |
|---|---|
client | ClientBuilder, channel pool, load balancing, resilience |
server | ServerBuilder, middleware layers |
tls | TLS via OxiTLS (Pure-Rust, no ring) |
compression | OxiARC-backed compress/decompress API (OxiArcGzip) |
gzip | gzip message compression via OxiARC (oxiarc-deflate) |
zstd | Zstandard compression via OxiARC (oxiarc-zstd) |
reflect | gRPC server reflection (v1 + v1alpha) |
health | gRPC health checking protocol |
web | gRPC-Web bridge (HTTP/1.1 → gRPC) + CORS layer |
aws-lc | AWS-LC backed adapter (opt-in, enables FFI) |
oxiproto | OxiProto type-system bridge — proto::OxiMessage, proto::OxiProtoError, prost types |
full | All Pure-Rust sub-features (no aws-lc, no oxiproto) |
§Migrating from tonic
oxirpc is a transparent wrapper over tonic 0.14. If you already use tonic,
migrating to oxirpc requires only dependency and import changes:
Before (tonic):
use tonic::transport::Server;
use tonic::{Request, Response, Status};
After (oxirpc):
use oxirpc::ServerBuilder; // wrapper with ergonomic extras
use oxirpc::{Request, Response, Status}; // same types, re-exportedAll tonic-generated stubs work with oxirpc without modification.
§Architecture
oxirpc (facade)
├── oxirpc-core — native types: Status, Metadata, Codec, Timeout, Encoding
├── oxirpc-client — ClientBuilder, load balancing, resilience (retry/circuit-breaker)
├── oxirpc-server — ServerBuilder, middleware layers
├── oxirpc-reflect — gRPC reflection services (v1/v1alpha)
├── oxirpc-health — health checking + K8s probes
├── oxirpc-web — gRPC-Web codec + CORS tower layer
└── oxirpc-build — build-time proto compilation (no protoc required)Modules§
- build
- Build utilities — see the
oxirpc-buildcrate for direct use inbuild.rs. - core
- Native gRPC primitives re-exported from
oxirpc-core. - interceptors
- Ready-to-use gRPC interceptor patterns.
- prelude
- Glob-importable common types.
Structs§
- Metadata
- A multimap of gRPC metadata key/value pairs.
- Request
- A gRPC request and metadata from an RPC call.
- Response
- A gRPC response and metadata from an RPC call.
- Status
- A gRPC status describing the result of an RPC call.
Enums§
- Code
- gRPC status codes used by
Status. - OxiRpc
Error - Errors returned by oxirpc operations.
- Status
Code - A canonical gRPC status code.
Functions§
- version
- The version of the
oxirpccrate, as reported by Cargo at build time.
Type Aliases§
- OxiRpc
Result - Convenience result alias for fallible OxiRPC operations.