grpc / grpc/grpc-rust

Ability to configure server and client mod names

Open
#1,137 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
12.5k
Forks
1.3k
Avg merge
4d 7h
Merged PRs (30d)
24

Description

## Feature Request

### Crates

- `tonic-build`

### Motivation

I'd like to reduce stutter in my pb definitions. For example if I have a service `example` (`service Example`)
```rust
pub mod example {
include!(concat!(env!("OUT_DIR"), "/example.rs"));
}
```

I'd like to be able to use it like this

```rust
use pb::example::server::ExampleServer;
```

### Proposal

Allow a way to configure the name of generated the server and client modules.

The relevant code is the following

```rust
let server_mod = quote::format_ident!("{}_server", naive_snake_case(service.name()));
```

And
```rust
let client_mod = quote::format_ident!("{}_client", naive_snake_case(service.name()));
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.