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

Re-export features of dependencies #169

Closed
bikeshedder opened this issue Nov 10, 2021 · 1 comment
Closed

Re-export features of dependencies #169

bikeshedder opened this issue Nov 10, 2021 · 1 comment
Labels
A-deadpool-* Area: deadpool backend discussion wontfix This will not be worked on

Comments

@bikeshedder
Copy link
Owner

This has been asked before. I can't seam to find the issue right now so I'm writing this down as a reminder.

Right now when using deadpool-postgres and using it together with tokio-postgres + with-uuid-0_8 there is no other way than adding both deadpool-postgres and tokio-postgres (+ with-uuid-0_8) to the dependencies while making sure that the versions match.

It was many times before if deadpool-postgres could just reexport all the feature flags of tokio-postgres. I have no absolute oppionion here and in the end decided against it as it's yet one more thing to maintain.

Just looking at tokio-postgres it is almost a no-brainer to re-export the features. Though when you look at deadpool-sqlite it would require 35 feature flags if I'm counting correctly.

https://github.com/rusqlite/rusqlite/blob/master/Cargo.toml - There are 30 feature flags and 7 optional dependencies. I believe two of the optional dependencies are not feature related (lazy_static and byteorder).

It would be so much easier if Cargo just had a way of enabling features of dependencies of dependencies like that:

deadpool-postgres = { version = "0.10", features = "tokio-postgres/with-uuid-0_8" }

A somewhat related cargo issue is this: rust-lang/cargo#9094

While this is not possible, I wonder if deadpool-* should work around this and re-export the features so the users of the deadpool-* crates don't have to import the backend crates themselves in order to activate features from them.


Another way to solve this would be to make the backend version explicit. e.g. deadpool-postgres in version 0.10 does have a feature called tokio-postgres-0_7 which enables the deadpool_postgres::tokio_postgres_0_7 module:

deadpool-postgres = { version = "0.10", features = ["tokio-postgres-0_7"] }
tokio-postgres = { version = "0.7", features = ["with-uuid-0_8"] }

This would make the versions 100% obvious to reason about and as a nice side-effect decouple the versions of deadpool-postgres from tokio-postgres. Right now whenever a breaking version of tokio-postgres is released a breaking version of deadpool-postgres must be released as well.

Big downside here would be that users of deadpool-postgres now have to use imports like use deadpool_postgres::tokio_postgres_0_7::Pool as the root of deadpool_postgres now contains no public exports whatsoever.

While it's easy to make this pretty in projects by creating an alias for deadpool_postgres::tokio_postgres_0_7 I'm undecided if that's actually the right path to walk on.

It feels like it adds yet another layer of confusion to an already confusing topic. 🙈

@bikeshedder bikeshedder added discussion A-deadpool-* Area: deadpool backend labels Nov 10, 2021
@bikeshedder bikeshedder added the wontfix This will not be worked on label Apr 30, 2022
@bikeshedder
Copy link
Owner Author

After long consideration I've decided not to implement this.

I don't like the idea of re-exporting feature flags from underlying crates as part of the deadpool-* crates.

Unless someone has a compelling reason why this is a must-have feature I won't be working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-deadpool-* Area: deadpool backend discussion wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant