(rust) prost: added simple protobuf sample for testing

This commit is contained in:
scbj
2025-06-02 16:05:05 +02:00
parent 4933c7dd14
commit a7d09cb062
6 changed files with 44 additions and 16 deletions
+11
View File
@@ -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"
+6
View File
@@ -0,0 +1,6 @@
use std::io::Result;
fn main() -> Result<()> {
prost_build::compile_protos(&["src/protest.proto"], &["src/"])?;
Ok(())
}
+5
View File
@@ -0,0 +1,5 @@
// pub mod protest;
pub mod protest {
include!(concat!(env!("OUT_DIR"), "/protest.rs"));
}
+19
View File
@@ -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;
}