23 releases (9 breaking)
Uses new Rust 2024
| 0.10.0-rc.5 | Jun 28, 2026 |
|---|---|
| 0.9.0-rc.1 | Jun 17, 2026 |
| 0.3.1 | Mar 30, 2026 |
#1077 in Network programming
376 downloads per month
Used in 9 crates
(7 directly)
2MB
38K
SLoC
vox — type-safe RPC with channels, service lanes, and automatic schema evolution.
Defining a service
Services are ordinary Rust traits annotated with #[vox::service]:
#[vox::service]
trait Hello {
async fn say_hello(&self) -> String;
}
The macro generates a HelloClient (typed caller), a HelloDispatcher
(request router), and serialization glue. You implement the trait on a
struct and hand it to a dispatcher.
Connecting
[connect()] is the fastest path to calling a remote service:
let conn = vox::connect("127.0.0.1:9000").await?;
let client: HelloClient = conn.open_lane().await?;
let reply = client.say_hello().await?;
The address string selects the transport:
| Scheme | Transport |
|---|---|
tcp://host:port (or bare host:port) |
TCP stream |
local://path |
Unix socket / Windows named pipe |
ws://host:port/path |
WebSocket |
Serving
[serve()] accepts connections in a loop:
vox::serve("0.0.0.0:9000", HelloDispatcher::new(HelloService)).await?;
For multi-service routing, use [lane_acceptor_fn()]:
vox::serve("0.0.0.0:9000", vox::lane_acceptor_fn(|req, conn| {
match req.service() {
"Hello" => { conn.handle_with(HelloDispatcher::new(HelloService)); Ok(()) }
"Chat" => { conn.handle_with(ChatDispatcher::new(ChatService)); Ok(()) }
_ => Err(vec![]),
}
})).await?;
Generated clients
Generated clients expose public fields for connection lifecycle:
client.caller.closed().await; // wait for disconnect
client.caller.is_connected(); // check liveness
client.connection.as_ref(); // access connection handle (service lanes)
client.say_hello().await?; // service method — no name clash
Lower-level APIs
For advanced use (custom transports, in-memory testing, multiple service lanes), use the builder APIs directly:
- [
initiator_on()] / [acceptor_on()] — establish over a rawLink - [
memory_link_pair()] — in-process link pair for testing Driver— run inbound RPC on a service lane handleConnectionHandle— open/close service lanes- [
proxy_lanes()] — bridge two service lane handles
vox
High-level Rust API for defining, implementing, and consuming Vox services.
Role in the Vox stack
vox sits at the RPC surface (Requests / Channels) and exposes the developer-facing service model.
What this crate provides
#[vox::service]-driven service definitions and generated clients/dispatchers- Core RPC traits and types re-exported for app-level use
- Feature-gated transport facade via
vox::transport:transport-tcp->vox::transport::tcptransport-local->vox::transport::local
- Integration point for the rest of the Rust runtime crates
Fits with
vox-corefor connection/driver/runtime internalsvox-typesfor protocol data modelvox-service-macrosfor code generation from service traits
Part of the Vox workspace: https://github.com/bearcove/vox
Dependencies
~12–29MB
~368K SLoC