Function chromiumoxide_pdl::build::generator::compile_pdls[][src]

pub fn compile_pdls<P: AsRef<Path>>(pdls: &[P]) -> Result<()>

Compile .pdl files into Rust files during a Cargo build.

The generated .rs files are written to the Cargo OUT_DIR directory, suitable for use with

This function should be called in a project’s build.rs.

Arguments

pdls - Paths to .pdl files to compile.

Errors

This function can fail for a number of reasons:

  • Failure to locate pdl files.
  • Failure to parse the .pdls.

It’s expected that this function call be unwraped in a build.rs; there is typically no reason to gracefully recover from errors during a build.

Example build.rs

fn main() -> Result<()> {
  chromiumoxide_pdl::build::compile_pdls(&["src/js.pdl", "src/browser.pdl"])?;
  Ok(())
}