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

Remove top-level re-exports #1477

Merged
merged 7 commits into from
Sep 19, 2023
Merged

Remove top-level re-exports #1477

merged 7 commits into from
Sep 19, 2023

Conversation

cpu
Copy link
Member

@cpu cpu commented Sep 14, 2023

This branch removes all top-level re-exports except for the "paved path" re-exports we expect all-to-most users will be using.

An informal poll indicates users find it confusing when there are multiple names for the same things. See #1386 for more discussion.

@cpu cpu self-assigned this Sep 14, 2023
@djc
Copy link
Member

djc commented Sep 15, 2023

It makes sense to me to relegate the crypto parts to a module, as I think these will be rarely used (assuming most users will pick the default crypto provider or select a crypto provider via a feature flag).

For the others, I really don't see removing the top-level re-exports as a good idea. These have been at the top-level forever, so we'd be putting every downstream user through a bunch of churn for the sole goal of removing the re-exports.

I suppose we could alternatively remove the "original" re-exports from the client/server modules instead, which I personally also find unattractive because the documentation for those modules provides a good place to find everything related to that particular context.

So, after considering all the context, I would prefer to keep the situation as-is for ClientConnection, ClientConfig, ServerName, ServerConfig and ServerConnection.

@cpu
Copy link
Member Author

cpu commented Sep 15, 2023

I would prefer to keep the situation as-is for ClientConnection, ClientConfig, ServerName, ServerConfig and ServerConnection.

@ctz @jsha What do you think of this proposal?

@cpu cpu requested a review from jsha September 15, 2023 13:29
@ctz
Copy link
Member

ctz commented Sep 15, 2023

I think of the API as being in two groups -- let's call them "paved path" and "detail". "Paved path" would be types that every user will need1, and I think it makes sense for these types to be front-and-centre at the top of the crate path hierarchy. "Detail" would be for complex uses, or types that need to be public but aren't directly referred to by name2, and everything else.

For these commits, I think the first 6 are "detail" that deserve to be lower down in the hierarchy rather than the top level. The rest of the commits I think are "paved path" types that deserve a place at the top of the hierarchy, but shouldn't be lost further down.

Footnotes

  1. I'm assuming every user is interested in being a TLS server and client -- probably not accurate.

  2. example: rustls::client::WantsClientCert -- needs to be public, but would never be named

@cpu
Copy link
Member Author

cpu commented Sep 15, 2023

@ctz What you describe makes sense to me, and I would be OK with leaving the server/client re-exports if we additionally moved some of your comment to a CONTRIBUTING.md style guide update to help evaluate additional re-exports in the future (happy to do that in this branch, or as a follow-up).

I'd like Jsha to have a chance to weigh in before I make updates to the branch since he opened #1386. Let's table this until then?

@jsha
Copy link
Contributor

jsha commented Sep 15, 2023 via email

@cpu
Copy link
Member Author

cpu commented Sep 18, 2023

I've restored the "paved path" re-exports and tacked on an update to CONTRIBUTING.md to mention this subject.

Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this done!

@cpu cpu added this pull request to the merge queue Sep 19, 2023
Merged via the queue into rustls:main with commit a3dd08b Sep 19, 2023
19 of 20 checks passed
@cpu cpu deleted the cpu-1386-no-reexports branch September 19, 2023 13:45
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

Successfully merging this pull request may close these issues.

None yet

4 participants