capnpc 0.8.1

Cap'n Proto schema compiler plugin

Crate capnpc [] [src]

Cap'n Proto Schema Compiler Plugin Library

This library allows you to do Cap'n Proto code generation within a Cargo build.

In your Cargo.toml:

  [package]
  build = "build.rs"

  [build-dependencies]
  capnpc = "*"

In your build.rs:

extern crate capnpc;

fn main() {
    ::capnpc::CompilerCommand::new()
        .src_prefix("schema")
        .file("schema/foo.capnp")
        .file("schema/bar.capnp")
        .run().expect("schema compiler command");
}

This will be equivalent to executing the shell command

  capnp compile -orust:$OUT_DIR --src-prefix=schema schema/foo.capnp schema/bar.capnp

Modules

codegen
codegen_types
schema
schema_capnp

Code generated from schema.capnp.

Structs

CompilerCommand

A builder object for schema compiler commands.