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

feat: add a builder() method to HttpsConnector #259

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

Fishrock123
Copy link
Contributor

It's become very idiomatic to have the builder api be accessed this way.

@Fishrock123 Fishrock123 force-pushed the builder-shortcut branch 2 times, most recently from be05a64 to 956111f Compare March 15, 2024 22:33
@Fishrock123
Copy link
Contributor Author

Not quite sure how to make rustdoc link those references correctly? 😕

@djc
Copy link
Member

djc commented Mar 18, 2024

See #260 (comment).

@Fishrock123
Copy link
Contributor Author

This PR could just as well be completely unrelated from the other two.

This is not necessary but is a common API idom for builder APIs in Rust.

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.

Fair point! I think this is a good change.

Tiny nit: as a constructor of sorts (even if indirectly), I would prefer we move builder() before enforce_https().

Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good to me modulo the CI docs failure getting fixed.

Not quite sure how to make rustdoc link those references correctly?

I think this diff will do the trick:

diff --git a/src/connector.rs b/src/connector.rs
index 103dede..5b975e0 100644
--- a/src/connector.rs
+++ b/src/connector.rs
@@ -35,9 +35,9 @@ impl<T> HttpsConnector<T> {
         self.force_https = true;
     }

-    /// Creates a [`builder::HttpsConnectorBuilder`] to configure a `HttpsConnector`.
+    /// Creates a [`crate::HttpsConnectorBuilder`] to configure a `HttpsConnector`.
     ///
-    /// This is the same as [`builder::HttpsConnectorBuilder::new()`].
+    /// This is the same as [`crate::HttpsConnectorBuilder::new()`].
     pub fn builder() -> builder::ConnectorBuilder<builder::WantsTlsConfig> {
         builder::ConnectorBuilder::new()
     }

It's become very idiomatic to have the builder api be accessed this way.
@cpu cpu enabled auto-merge March 20, 2024 19:32
@cpu cpu added this pull request to the merge queue Mar 20, 2024
Merged via the queue into rustls:main with commit 4030f86 Mar 20, 2024
11 checks passed
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.

3 participants