Skip to content

Rust Integration

For Rust developers, XIDL provides xidl-build to automatically generate code in build.rs without needing to install xidlc:

  1. Cargo.toml:

    [build-dependencies]
    xidl-build = "<version>"
  2. Add build.rs:

    fn main() {
    xidl_build::Builder::new()
    .with_lang("rust")
    .compile(&["api/example.idl"])
    .expect("generate xidl artifacts");
    }
  3. Include generated code in source:

    include!(concat!(env!("OUT_DIR"), "/api/example.rs"));