Protobuf implementation in Rust.
- Written in pure rust
- Generate rust code
- Has runtime library for generated code (Coded{Input|Output}Stream impl)
- Incomplete and unstable
- Install protobuf for
protoc
binary.
On OS X Homebrew can be used:
brew install protobuf
- Compile the project:
cd src
./rebuild.sh
protoc-gen-rust
binary is generated. protoc-gen-rust
is a rust
plugin for protoc.
- Add
protoc-gen-rust
to $PATH:
PATH="`pwd`:$PATH"
- Generate .rs files:
protoc --rust_out . foo.proto
This will generate .rs files in current directory.
Same procedure is used to regenerate .rs files for rust-protobuf
itself, see ./regerate.sh
.
- Include generated files into your project .rc file:
extern mod protobuf; // depend on rust-protobuf runtime
mod foo; // add generated file to the project
Have a look at generated files, used internally in rust-protobuf:
- shrug.rs for shrug.proto (used by rust-protobuf tests)
- descriptor.rs for descriptor.proto (that is part of Google protobuf)
- Implement some rust-specific options
- Deal better with namespaces
- Store unknown fields
- Protobuf reflection
- Extensions
- default_instance for messages with repeated fields
- Generate stubs for services
- Comprehensive test suite
- Default value
@stepancheg on github if you have any questions, suggesions or patches.