108 releases

0.14.4 Jun 11, 2021
0.14.2 Dec 30, 2020
0.13.1 Jul 7, 2020
0.12.1 Feb 13, 2020
0.0.5 Nov 23, 2014

#111 in Network programming

Download history 3161/week @ 2021-05-25 2997/week @ 2021-06-01 2740/week @ 2021-06-08 4099/week @ 2021-06-15 3147/week @ 2021-06-22 3136/week @ 2021-06-29 3775/week @ 2021-07-06 3585/week @ 2021-07-13 4434/week @ 2021-07-20 4162/week @ 2021-07-27 6028/week @ 2021-08-03 6273/week @ 2021-08-10 5102/week @ 2021-08-17 5177/week @ 2021-08-24 3538/week @ 2021-08-31 3633/week @ 2021-09-07

13,552 downloads per month
Used in 47 crates (19 directly)

MIT license

750KB
15K SLoC

Cap'n Proto code generation for Rust

crates.io

documentation

The generated code depends on the capnproto-rust runtime library.

Code generation can be customized through the annotations defined in rust.capnp.


lib.rs:

Cap'n Proto Schema Compiler Plugin Library

This library allows you to do Cap'n Proto code generation within a Cargo build. You still need the capnp binary (implemented in C++). (If you use a package manager, try looking for a package called capnproto.)

In your Cargo.toml:

[package]
build = "build.rs"

[build-dependencies]
capnpc = "0.14"

In your build.rs:

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

Dependencies