Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 935 Bytes

README.md

File metadata and controls

27 lines (18 loc) · 935 Bytes

tagger_capnp

Cap'n Proto schemata and generated Rust code

Why the code is checked in to git

There are different conventions on how to deal with autogenerated code like that produced by capnp:

  • autogenerate the code on every build
  • autogenerate the code once and commit it to version control

There are pros and cons to each approach, but for our use case, checking in the code is better for the following reasons:

  • Users do not need to install capnp as a build-time dependency
  • LSP/IDE tooling on the checked-in code works without configuration; it's rather verbose and hierarchical so tab-completion is a lifesaver

Updating generated code

In the crate root directory, the command to compile a schema capnp/tag_server.capnp, strip the prefix directory capnp, and put the resulting code in the src directory, is the following:

capnp compile -orust:src --src-prefix=capnp capnp/tag_server.capnp