Skip to main content

Crate oxirpc

Crate oxirpc 

Source
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

FeatureWhat it enables
clientClientBuilder, channel pool, load balancing, resilience
serverServerBuilder, middleware layers
tlsTLS via OxiTLS (Pure-Rust, no ring)
compressionOxiARC-backed compress/decompress API (OxiArcGzip)
gzipgzip message compression via OxiARC (oxiarc-deflate)
zstdZstandard compression via OxiARC (oxiarc-zstd)
reflectgRPC server reflection (v1 + v1alpha)
healthgRPC health checking protocol
webgRPC-Web bridge (HTTP/1.1 → gRPC) + CORS layer
aws-lcAWS-LC backed adapter (opt-in, enables FFI)
oxiprotoOxiProto type-system bridge — proto::OxiMessage, proto::OxiProtoError, prost types
fullAll 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-exported

All 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-build crate for direct use in build.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.
OxiRpcError
Errors returned by oxirpc operations.
StatusCode
A canonical gRPC status code.

Functions§

version
The version of the oxirpc crate, as reported by Cargo at build time.

Type Aliases§

OxiRpcResult
Convenience result alias for fallible OxiRPC operations.