(rust) prost: added simple protobuf sample for testing
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "proto"
|
||||
build = "build.rs"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
prost = "0.13"
|
||||
|
||||
[build-dependencies]
|
||||
prost-build = "0.13"
|
||||
@@ -0,0 +1,6 @@
|
||||
use std::io::Result;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
prost_build::compile_protos(&["src/protest.proto"], &["src/"])?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// pub mod protest;
|
||||
|
||||
pub mod protest {
|
||||
include!(concat!(env!("OUT_DIR"), "/protest.rs"));
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package protest;
|
||||
|
||||
message Payload {
|
||||
/*
|
||||
* The package index of the given message, so which part of the message is
|
||||
* currently being loaded.
|
||||
*/
|
||||
uint64 index = 1;
|
||||
/*
|
||||
* The total block count.
|
||||
*/
|
||||
uint64 blocks = 2;
|
||||
/*
|
||||
* The resulting payload to be loaded
|
||||
*/
|
||||
bytes payload = 3;
|
||||
}
|
||||
Reference in New Issue
Block a user