Trying to use the prost
Some checks failed
ci/woodpecker/push/code_tests Pipeline failed
ci/woodpecker/push/pre_commit_test Pipeline failed

This commit is contained in:
2025-11-28 19:18:04 +01:00
parent 56aa1e1bbf
commit 2052178ebf
8 changed files with 52 additions and 78 deletions

60
Cargo.lock generated
View File

@@ -666,7 +666,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
name = "lib" name = "lib"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"tonic-prost-build", "prost",
"prost-build",
"prost-types",
"uuid", "uuid",
] ]
@@ -981,8 +983,6 @@ dependencies = [
"prettyplease", "prettyplease",
"prost", "prost",
"prost-types", "prost-types",
"pulldown-cmark",
"pulldown-cmark-to-cmark",
"regex", "regex",
"syn", "syn",
"tempfile", "tempfile",
@@ -1010,26 +1010,6 @@ dependencies = [
"prost", "prost",
] ]
[[package]]
name = "pulldown-cmark"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e8bbe1a966bd2f362681a44f6edce3c2310ac21e4d5067a6e7ec396297a6ea0"
dependencies = [
"bitflags 2.10.0",
"memchr",
"unicase",
]
[[package]]
name = "pulldown-cmark-to-cmark"
version = "21.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8246feae3db61428fd0bb94285c690b460e4517d83152377543ca802357785f1"
dependencies = [
"pulldown-cmark",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.42" version = "1.0.42"
@@ -1312,18 +1292,6 @@ dependencies = [
"tracing", "tracing",
] ]
[[package]]
name = "tonic-build"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c40aaccc9f9eccf2cd82ebc111adc13030d23e887244bc9cfa5d1d636049de3"
dependencies = [
"prettyplease",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "tonic-prost" name = "tonic-prost"
version = "0.14.2" version = "0.14.2"
@@ -1335,22 +1303,6 @@ dependencies = [
"tonic", "tonic",
] ]
[[package]]
name = "tonic-prost-build"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4a16cba4043dc3ff43fcb3f96b4c5c154c64cbd18ca8dce2ab2c6a451d058a2"
dependencies = [
"prettyplease",
"proc-macro2",
"prost-build",
"prost-types",
"quote",
"syn",
"tempfile",
"tonic-build",
]
[[package]] [[package]]
name = "tower-layer" name = "tower-layer"
version = "0.3.3" version = "0.3.3"
@@ -1426,12 +1378,6 @@ dependencies = [
"ratatui", "ratatui",
] ]
[[package]]
name = "unicase"
version = "2.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.22" version = "1.0.22"

View File

@@ -1,5 +1,6 @@
mod audio_engine; mod audio_engine;
use clap::Parser; use clap::Parser;
use lib::helloworld;
/// Simple program to greet a person /// Simple program to greet a person
#[derive(Parser, Debug)] #[derive(Parser, Debug)]

View File

@@ -4,7 +4,9 @@ version = "0.1.0"
edition = "2024" edition = "2024"
[dependencies] [dependencies]
prost = "0.14.1"
uuid = { version = "1.18.1", features = ["v4"] } uuid = { version = "1.18.1", features = ["v4"] }
[build-dependencies] [build-dependencies]
tonic-prost-build = "0.14.2" prost-build = "0.14.1"
prost-types = "0.14.1"

View File

@@ -1,4 +1,13 @@
fn main() -> Result<(), Box<dyn std::error::Error>> { use std::{fs, io::Result};
tonic_prost_build::compile_protos("proto/helloworld.proto")?; fn main() -> Result<()> {
//let proto_dir = "proto";
//let paths = fs::read_dir(proto_dir).unwrap();
//for path in paths {
// prost_build::compile_protos(&[path.unwrap().path()], &[proto_dir])?;
//}
prost_build::compile_protos(&["proto/audio_backend.proto"], &["proto/"])?;
prost_build::compile_protos(&["proto/items.proto"], &["proto/"])?;
Ok(()) Ok(())
} }

View File

@@ -0,0 +1,6 @@
syntax = "proto3";
package termix.audio_backend;
service AudioBackend {
}

View File

@@ -1,14 +0,0 @@
syntax = "proto3";
package helloworld;
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply);
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}

18
lib/proto/items.proto Normal file
View File

@@ -0,0 +1,18 @@
syntax = "proto3";
package snazzy.items;
// A snazzy new shirt!
message Shirt {
// Label sizes
enum Size {
SMALL = 0;
MEDIUM = 1;
LARGE = 2;
}
// The base color
string color = 1;
// The size as stated on the label
Size size = 2;
}

View File

@@ -1,5 +1,11 @@
pub mod metadata; pub mod snazzy {
pub mod items {
include!(concat!(env!("OUT_DIR"), "/snazzy.items.rs"));
}
}
pub mod project; pub mod termix {
pub mod region; pub mod audio_backend {
pub mod track; include!(concat!(env!("OUT_DIR"), "/termix.audio_backend.rs"));
}
}