Skip to content

Commit a49949a

Browse files
refactor: rename crate protobuf-nats-service-generator
Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>
1 parent f7a1e76 commit a49949a

File tree

7 files changed

+22
-21
lines changed

7 files changed

+22
-21
lines changed

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ provider-archive = { version = "^0.14.0", path = "./crates/provider-archive", de
282282
proto = { version = "0.1.2", default-features = false }
283283
prost = { version = "0.13.4", default-features = false }
284284
prost-build = { version = "0.13.4", default-features = false }
285+
protobuf-nats-service-generator = { version = "0.1", path = "./crates/protobuf-nats-service-generator", default-features = false }
285286
quote = { version = "1", default-features = false }
286287
rand = { version = "0.8", default-features = false }
287288
redis = { version = "0.25", default-features = false }
@@ -369,7 +370,6 @@ wasmcloud-provider-messaging-kafka = { version = "*", path = "./crates/provider-
369370
wasmcloud-provider-messaging-nats = { version = "^0.24.0", path = "./crates/provider-messaging-nats", default-features = false }
370371
wasmcloud-provider-sdk = { version = "^0.13.0", path = "./crates/provider-sdk", default-features = false }
371372
wasmcloud-provider-sqldb-postgres = { version = "*", path = "./crates/provider-sqldb-postgres", default-features = false }
372-
wasmcloud-proto-generator = { version = "0.1", path = "./crates/wasmcloud-proto-generator", default-features = false }
373373
wasmcloud-runtime = { version = "^0.8.0", path = "./crates/runtime", default-features = false }
374374
wasmcloud-secrets-client = { version = "^0.6.0", path = "./crates/secrets-client", default-features = false }
375375
wasmcloud-secrets-types = { version = "^0.5.0", path = "./crates/secrets-types", default-features = false }

crates/wasmcloud-proto-generator/Cargo.toml renamed to crates/protobuf-nats-service-generator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "wasmcloud-proto-generator"
2+
name = "protobuf-nats-service-generator"
33
version = "0.1.0"
44
authors.workspace = true
55
categories.workspace = true

crates/wasmcloud-proto-generator/README.md renamed to crates/protobuf-nats-service-generator/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# wasmcloud-proto-generator
1+
# protobuf-nats-service-generator
22

33
> [!WARNING]
44
> This crate is experimental and likely to experience breaking changes. Used as the service generator for [wasmcloud-proto-types](../wasmcloud-proto-types/) and should be used individually with caution.
55
6-
This crate is responsible for generating `Server` and `Client` traits for [wasmcloud-proto-types](../wasmcloud-proto-types/), enabling simple client-side requests using [async-nats](https://crates.io/crates/async-nats) and implementing and handling server-side requests using a generated trait.
6+
This crate is responsible for generating `Server` and `Client` traits from protobuf service definitions, enabling simple client-side requests using [async-nats](https://crates.io/crates/async-nats) and implementing and handling server-side requests using a generated trait.
77

88
## Example generated code
99

1010
```rust
1111
// This file is @generated by prost-build.
1212
/// --------------------------------------------------------------
13-
/// This file was generated by `some_wasmcloud` crate
13+
/// This file was generated by the `protobuf-nats-service-generator` crate
1414
/// DO NOT MODIFY DIRECTLY
1515
/// --------------------------------------------------------------
1616
use anyhow::Context as _;
@@ -47,8 +47,8 @@ pub trait ControlInterfaceServiceClient {
4747
Output = ::anyhow::Result<StartComponentResponse>,
4848
> + Send;
4949
}
50-
/// Send request [StartComponentRequest], receiving the decoded [StartComponentResponse]
5150
impl ControlInterfaceServiceClient for ::async_nats::Client {
51+
/// Send request [StartComponentRequest], decode response as [StartComponentResponse]
5252
async fn start_component(
5353
&self,
5454
request: StartComponentRequest,
@@ -122,6 +122,7 @@ where
122122
Ok(())
123123
})
124124
}
125+
125126
```
126127

127128
## Considerations

crates/wasmcloud-proto-generator/src/lib.rs renamed to crates/protobuf-nats-service-generator/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use convert_case::{Case, Casing};
22
use prost_build::{Service, ServiceGenerator};
33

4-
pub struct WasmcloudProtoGenerator;
4+
pub struct NatsServiceGenerator;
55

6-
impl ServiceGenerator for WasmcloudProtoGenerator {
6+
impl ServiceGenerator for NatsServiceGenerator {
77
fn generate(&mut self, service: Service, buf: &mut String) {
88
let client_handlers_trait = get_client_handlers_trait(&service);
99
let client_nats_implementation = get_client_nats_implementation(&service);
@@ -27,7 +27,7 @@ impl ServiceGenerator for WasmcloudProtoGenerator {
2727
fn finalize(&mut self, _buf: &mut String) {
2828
const IMPORTS_CODE: &str = r#"
2929
/// --------------------------------------------------------------
30-
/// This file was generated by `some_wasmcloud` crate
30+
/// This file was generated by the `protobuf-nats-service-generator` crate
3131
/// DO NOT MODIFY DIRECTLY
3232
/// --------------------------------------------------------------
3333
use anyhow::Context as _;

crates/wasmcloud-proto-types/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ futures = { workspace = true }
2222

2323
[build-dependencies]
2424
prost-build = { workspace = true, features = ["format"] }
25-
wasmcloud-proto-generator = { workspace = true }
25+
protobuf-nats-service-generator = { workspace = true }
2626

2727
[dev-dependencies]
2828
async-nats = { workspace = true, features = ["ring"] }

crates/wasmcloud-proto-types/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use wasmcloud_proto_generator::WasmcloudProtoGenerator;
1+
use protobuf_nats_service_generator::NatsServiceGenerator;
22

33
fn main() -> std::io::Result<()> {
44
// Find all the .proto files
@@ -17,7 +17,7 @@ fn main() -> std::io::Result<()> {
1717

1818
prost_build::Config::new()
1919
.out_dir("src/generated")
20-
.service_generator(Box::new(WasmcloudProtoGenerator))
20+
.service_generator(Box::new(NatsServiceGenerator))
2121
.compile_protos(&protos, &["src/"])?;
2222
Ok(())
2323
}

0 commit comments

Comments
 (0)