#google #protobuf #proto #dropbox

bin+lib pb-jelly-gen

A protobuf binding generation framework for the Rust language developed at Dropbox

4 releases

new 0.0.5 Nov 20, 2020
0.0.4 Oct 21, 2020
0.0.3 Sep 21, 2020
0.0.2 Sep 19, 2020
0.0.1 Sep 16, 2020

#200 in Encoding

49 downloads per month

Apache-2.0

150KB
2.5K SLoC

Python 2.5K SLoC // 0.1% comments Rust 195 SLoC // 0.1% comments Batch 2 SLoC

pb-jelly-gen

It's working! It's working! - Anakin Skywalker

Crates.io Documentation Crates.io

This crate provides a tool to generate Rust code from proto2 or proto3 files.

How To Use

python + protoc

The core of this crate is a python script codegen.py that is provided to the protobuf compiler, protoc as a plugin. There are a few python depdendencies which can be installed by running one of two commands:

  1. Running pip install six protobuf typing or...
  2. Running pip install -r requirements.txt from the root of this crate, if you have it cloned.

You'll also need the protobuf compiler which you can get by:

  1. Running brew install protobuf or...
  2. Build from source protobuf

Once you've completed the above steps, you should include this crate as a build-dependency in your Cargo.toml and then call the API of this crate from a build.rs files in the root of your repo.

Cargo.toml
[build-dependencies]
pb-jelly-gen = "0.0.5"
build.rs
use pb_jelly_gen::gen_protos;

fn main() -> std::io::Result<()> {
    // Replace `./protos` with a path to your proto files.
    gen_protos(vec!["./protos"])
}

Dependencies

~1–1.5MB
~32K SLoC