#protobuf #codegen #protocol-buffers #google #binary #protocol

bin+lib protobuf-codegen

Code generator for rust-protobuf. Includes a library and protoc-gen-rust binary. See protoc-rust and protobuf-codegen-pure crates

48 stable releases

Uses old Rust 2015

new 2.18.1 Nov 22, 2020
2.17.0 Aug 12, 2020
2.16.2 Jul 6, 2020
2.12.0 Mar 26, 2020
1.6.0 May 11, 2018

#127 in Network programming

Download history 14150/week @ 2020-08-07 14572/week @ 2020-08-14 14458/week @ 2020-08-21 14973/week @ 2020-08-28 13982/week @ 2020-09-04 15424/week @ 2020-09-11 14368/week @ 2020-09-18 15725/week @ 2020-09-25 14784/week @ 2020-10-02 16217/week @ 2020-10-09 16523/week @ 2020-10-16 15950/week @ 2020-10-23 15436/week @ 2020-10-30 16084/week @ 2020-11-06 19093/week @ 2020-11-13 17607/week @ 2020-11-20

66,944 downloads per month
Used in 152 crates (13 directly)

MIT license

1.5MB
29K SLoC

protobuf-codegen

This crate contains protobuf code generator and a protoc-gen-rust protoc plugin.

protoc-gen-rust

protoc-gen-rust implements standard protobuf protoc plugin conventions.

Probably you do not want to use it directly in Rust environment, there are easier to use alternatives:

  • protoc-rust crate which can be invoked programmatically from build.rs of your project which requires only protoc in $PATH but not protoc-gen-rust.
  • protobuf-codegen-pure crate which behaves like protoc-rust, but does not depend on protoc binary

But if you really want to use that plugin, here's the instruction

(Note protoc can be invoked programmatically with protoc crate)

  1. Install protobuf for protoc binary.

On OS X Homebrew can be used:

brew install protobuf

On Ubuntu, protobuf-compiler package can be installed:

apt-get install protobuf-compiler

Protobuf is needed only for code generation, rust-protobuf runtime does not use protobuf library.

  1. Install protoc-gen-rust program (which is protoc plugin)

It can be installed either from source or with cargo install protobuf command.

  1. Add protoc-gen-rust to $PATH

If you installed it with cargo, it should be

PATH="$HOME/.cargo/bin:$PATH"
  1. Generate .rs files:
protoc --rust_out . foo.proto

This will generate .rs files in current directory.

Dependencies