#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

57 stable releases

Uses old Rust 2015

new 2.24.1 Jun 11, 2021
2.22.1 Mar 18, 2021
2.18.1 Nov 22, 2020
2.16.2 Jul 6, 2020
1.6.0 May 11, 2018

#15 in Network programming

Download history 20833/week @ 2021-02-21 18583/week @ 2021-02-28 16899/week @ 2021-03-07 18097/week @ 2021-03-14 22145/week @ 2021-03-21 19593/week @ 2021-03-28 21762/week @ 2021-04-04 20934/week @ 2021-04-11 21258/week @ 2021-04-18 24199/week @ 2021-04-25 20064/week @ 2021-05-02 25676/week @ 2021-05-09 22181/week @ 2021-05-16 19408/week @ 2021-05-23 20055/week @ 2021-05-30 20558/week @ 2021-06-06

90,988 downloads per month
Used in 175 crates (13 directly)

MIT license

31K SLoC


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


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

  1. Generate .rs files:
protoc --rust_out . foo.proto

This will generate .rs files in current directory.