Skip to content

Instantly share code, notes, and snippets.

@jamesray1
Created June 20, 2018 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesray1/6bd12f74e047c73f04b986dd1f727efb to your computer and use it in GitHub Desktop.
Save jamesray1/6bd12f74e047c73f04b986dd1f727efb to your computer and use it in GitHub Desktop.
James@DESKTOP-EL89DSR MINGW64 ~/jrl (pure-rust-protoc)
$ git diff master
diff --git a/floodsub/Cargo.toml b/floodsub/Cargo.toml
index 0d187c7..02d5b17 100644
--- a/floodsub/Cargo.toml
+++ b/floodsub/Cargo.toml
@@ -17,3 +17,7 @@ protobuf = "2"
smallvec = "0.6.0"
tokio-io = "0.1"
varint = { path = "../varint-rs" }
+
+[build-dependencies]
+protobuf-codegen-pure = "2"
+
diff --git a/floodsub/build.rs b/floodsub/build.rs
index dc63fab..59bc113 100644
--- a/floodsub/build.rs
+++ b/floodsub/build.rs
@@ -1,9 +1,10 @@
extern crate protobuf_codegen_pure;
-protobuf_codegen_pure::run(protobuf_codegen_pure::Args {
- out_dir: "src",
- input: "rpc.proto",
- customize: protobuf_codegen_pure::Customize {
- ..Default::default()
- },
-}).expect("protoc");
\ No newline at end of file
+fn main() {
+ protobuf_codegen_pure::run(protobuf_codegen_pure::Args {
+ out_dir: "src/protobuf_structs",
+ input: &["src/rpc.proto"],
+ includes: &["src"],
+ customize: Default::default(),
+ }).expect("protoc failed to run");
+}
diff --git a/floodsub/src/lib.rs b/floodsub/src/lib.rs
index 49d6d4e..1f7b587 100644
--- a/floodsub/src/lib.rs
+++ b/floodsub/src/lib.rs
@@ -33,6 +33,7 @@ extern crate smallvec;
extern crate tokio_io;
extern crate varint;
+#[path = "protobuf_structs/rpc.rs"]
mod rpc_proto;
mod topic;
diff --git a/floodsub/src/rpc_proto.rs b/floodsub/src/protobuf_structs/rpc.rs
similarity index 86%
rename from floodsub/src/rpc_proto.rs
rename to floodsub/src/protobuf_structs/rpc.rs
index a0557bb..b970324 100644
--- a/floodsub/src/rpc_proto.rs
@jamesray1
Copy link
Author

This is a partial output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment