capnproto-rust icon indicating copy to clipboard operation
capnproto-rust copied to clipboard

Add documentation

Open emberian opened this issue 11 years ago • 6 comments

capnproto-rust is currently impenetrable besides the examples. If one is not already familiar with using it in C++, it's very hard to "dive in".

emberian avatar Sep 06 '14 18:09 emberian

There are examples? Seriously, I can't find any examples of even the most basic usage.

mchaput avatar Jan 05 '15 19:01 mchaput

@mchaput looks like they got moved to https://github.com/dwrensha/capnpc-rust

emberian avatar Jan 05 '15 19:01 emberian

@dwrensha Could you provide an example of deserializing a capnp message to a Rust struct? The only example in capnpc-rust is of manually extracting the fields.

alexchandel avatar Apr 28 '15 13:04 alexchandel

There currently is no way to automatically convert between native Rust structs and Cap'n Proto messages. I discussed this a bit here.

dwrensha avatar Apr 28 '15 13:04 dwrensha

I'm curious how one even installs capnp-rust and executes it with capnpc?

drusellers avatar Nov 22 '17 19:11 drusellers

@drusellers

Step one is to make sure you have the capnp tool installed, as in: https://capnproto.org/install.html

Then the usual way to generate rust code from capnpc-rust is through a build script, as in this example. This invokes capnp compile -o - as a child process and uses the capnpc-rust crate as a library to consume the result.

Alternatively, you can use the capnpc-rust binary target. You need to give the capnp tool a way to find it; one way to do that would be to copy target/release/capnpc-rust into the same directory as the capnp tool and the capnpc-c++ and capnpc-capnp plugins -- for me that's /usr/local/bin/. Then you should be able to do capnp compile -orust foo.capnp.

dwrensha avatar Nov 23 '17 14:11 dwrensha