Skip to content

xidlc rust-axum

The rust-axum target generates Rust HTTP bindings for Axum-based services and clients.

Minimal flow

xidlc --lang rust-axum --out-dir generated hello_world.idl

Generate OpenAPI alongside it when you need a schema document:

xidlc --lang openapi --out-dir generated hello_world.idl

What gets generated

For each interface, the target currently emits:

  • a Rust trait for business logic
  • a server wrapper that wires routes and request parsing
  • a client wrapper
  • transport helper types used by generated adapters

Minimal server shape

mod imp;

use imp::HelloWorld;
use imp::HelloWorldServer;

struct HelloWorldImpl;

#[async_trait::async_trait]
impl HelloWorld for HelloWorldImpl {
    async fn say_hello(
        &self,
        name: String,
    ) -> Result<(), xidl_rust_axum::Error> {
        println!("hello {}", name);
        Ok(())
    }
}

Runtime pairing

Generated code is designed to work with xidl-rust-axum.

Use this target with: