codegen
Generate code from a single Vexil schema file.
Usage
vexilc codegen <file.vexil> [--target <target>] [--output <path>]
Options
| Option | Default | Description |
|---|---|---|
--target <target> | rust | Code generation target: rust, typescript, go, or python |
--output <path> | stdout | Write output to a file instead of stdout |
Examples
# Generate Rust to stdout
vexilc codegen sensor.vexil
# Generate TypeScript to a file
vexilc codegen sensor.vexil --target typescript --output sensor.ts
# Generate Go
vexilc codegen sensor.vexil --target go --output sensor.go
# Generate Python
vexilc codegen sensor.vexil --target python --output sensor.py
Notes
- For schemas with imports, use
buildinstead - The generated code depends on the corresponding runtime library (
vexil-runtimefor Rust,@vexil-lang/runtimefor TypeScript,vexil-runtimeGo module, orvexil_runtimePython module) - Schema errors are reported before code generation begins
- Traits and the portable impl-function body subset are generated in every target; unsupported calls, assignments, types, and target-name collisions are reported before output