Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation #10

Open
emberian opened this issue Sep 6, 2014 · 6 comments
Open

Add documentation #10

emberian opened this issue Sep 6, 2014 · 6 comments

Comments

@emberian
Copy link
Contributor

emberian commented Sep 6, 2014

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".

@mchaput
Copy link

mchaput commented Jan 5, 2015

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

@emberian
Copy link
Contributor Author

emberian commented Jan 5, 2015

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

@alexchandel
Copy link

@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.

@dwrensha
Copy link
Member

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

@drusellers
Copy link

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

@dwrensha
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants