Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idiomatic import paths #1694

Open
jun-sheaf opened this issue May 1, 2024 · 0 comments
Open

Idiomatic import paths #1694

jun-sheaf opened this issue May 1, 2024 · 0 comments

Comments

@jun-sheaf
Copy link

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.

Alternatives

One can manually add these aliases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant