grpc / grpc/grpc-rust

Idiomatic import paths

Open
#1,694 0 comments 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`

### Proposal

For every `service ServiceName` definition, we add

```
pub mod service_name {
pub use super::{
service_name_client::ServiceNameClient,
service_name_server::{ServiceName, ServiceNameServer},
};
}

pub use service_name::ServiceName;
```

#### Pros

- Simpler, cleaner imports
- Naming follows `prost`. E.g. nested messages.

#### Cons

- Users need to use different imports (or we can just alias these and not make a breaking change)

### Motivation

Currently, we separate the client and server in two distinct modules which is not as idiomatic as just have one module that exports the client and server exports. For precedent, see [`std::path::Path`](https://doc.rust-lang.org/std/path/struct.Path.html).

### Alternatives

One can manually add these aliases.

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.