Skip to content

xidlc Usage Guide

xidlc is the standard entry point for XIDL. It reads one or more .idl files and generates artifacts for the selected targets.

The way xidlc works is straightforward:

  1. Input one or more IDL files.
  2. Select a target generator.
  3. Specify the output directory.
  4. Obtain the files corresponding to that target.

Minimal command:

Terminal window
xidlc gen --out-dir out rust path/to/file.idl

Short version:

Terminal window
xidlc gen -o out rust path/to/file.idl
  • --out-dir, -o: Specify the output directory.
  • <lang>: Select the target generator subcommand under xidlc gen.
  • --client: Generate additional client-related artifacts for targets that support this parameter.
  • --server: Generate server-related artifacts for targets that support this parameter.
  • --dry-run: Execute the parsing and generation process without writing files to disk.
Terminal window
xidlc gen -o src/generated rust api.idl
Terminal window
xidlc gen -o src/generated rust-axum api.idl
Terminal window
xidlc gen -o src/generated rust-jsonrpc api.idl
Terminal window
xidlc gen -o generated openapi api.idl
Terminal window
xidlc gen -o generated openrpc api.idl

The CLI also provides a formatting subcommand:

Terminal window
xidlc fmt path/to/file.idl

In-place formatting:

Terminal window
xidlc fmt --inplace path/to/file.idl