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

make with_provider_and_* take Arc<CryptoProvider> instead of CryptoProvider #282

Closed
cpu opened this issue Aug 26, 2024 · 1 comment · Fixed by #283
Closed

make with_provider_and_* take Arc<CryptoProvider> instead of CryptoProvider #282

cpu opened this issue Aug 26, 2024 · 1 comment · Fixed by #283
Labels
next-major-release breaking changes that should happen in the next major release

Comments

@cpu
Copy link
Member

cpu commented Aug 26, 2024

Suggested by Adrian in discord:

Hey there, seems like hyper-rustls' with_provider_and_* methods take a CryptoProvider, meaning that it's impossible to call CryptoProvider::get_default() in a library and pass that as the argument (since getting an owned value out of the Arc is not really possible). I think the API should take an Arc, just like rustls' ClientConfig::with_provider, which it calls internally (by creating an Arc via .into()).

Ctz mentioned impossible might be an overstatement (e.g. due to Arc::unwrap_or_clone()) but in general there was agreement that the API should be changed to take an Arc.

We should consider making this change alongside future breaking API changes.

@cpu cpu added the next-major-release breaking changes that should happen in the next major release label Aug 26, 2024
@djc
Copy link
Member

djc commented Aug 26, 2024

On the rustls side I think we used an impl Into<Arc<T>> to make this change (somewhat) backwards compatibly. Might be an option here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next-major-release breaking changes that should happen in the next major release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@djc @cpu and others