-
Notifications
You must be signed in to change notification settings - Fork 393
Open
Description
project directories
tree .
.
├── build.rs
├── Cargo.toml
├── demo
│ └── main.rs
└── proto
├── common
│ └── header.proto
├── mod.rs
└── module
├── header.proto
└── items.proto
common/header.proto:
syntax = "proto2";
package common.header;
message Header {
optional uint64 id = 1;
optional uint64 timestamp_ms = 2;
}
module/header.proto:
syntax = "proto2";
package module.header;
message Header {
optional string source = 1;
}
module/items.proto:
syntax = "proto2";
import "proto/common/header.proto";
package module.items;
message Items {
optional common.header.Header header = 1;
optional string name = 2;
}
build.rs
use protobuf_codegen::Codegen;
fn main() {
let mut codegen = Codegen::new();
codegen
.protoc()
.cargo_out_dir("proto")
.includes(&["./"])
.inputs(&[
"./proto/common/header.proto",
"./proto/module/header.proto",
"./proto/module/items.proto",
]);
if let Ok(protoc_env) = std::env::var("PROTOC") {
codegen.protoc_path(std::path::Path::new(&protoc_env));
}
codegen.run_from_script();
}
mod.rs:
// @generated
pub mod header;
pub mod header;
pub mod items;
DreamerLx and jokemanfire
Metadata
Metadata
Assignees
Labels
No labels