vexil-codegen-rust 0.2.2

Rust code generation backend for the Vexil schema compiler
Documentation

vexil-codegen-rust

Rust code generation backend for the Vexil schema compiler.

Takes a CompiledSchema from vexil-lang and emits Rust structs, enums, and Pack/Unpack trait implementations that serialize to the Vexil wire format.

Usage

Single file

use vexil_lang::compile;
use vexil_codegen_rust::generate;

let result = compile(source);
let compiled = result.compiled.expect("no errors");
let code: String = generate(&compiled)?;

Multi-file project

use vexil_lang::compile_project;
use vexil_codegen_rust::RustBackend;
use vexil_lang::codegen::CodegenBackend;

let project = compile_project(&root_source, &root_path, &loader)?;
let files: Vec<(PathBuf, String)> = RustBackend.generate_project(&project)?;
// files includes per-schema .rs files and a mod.rs with re-exports

Generated code depends on vexil-runtime for bit-level I/O and the Pack/Unpack traits.

License

Licensed under either of MIT or Apache-2.0 at your option.