-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Ergonomics issue with PostgresConnectionManager #57
Comments
I wonder if this is really a bug with Any thoughts @sfackler? |
Just want to pile on here to say I'm having the same issue -- in fact I'm trying to store the connection manager and the pool that gets created. At first I tried to use the code that @ufoscout wrote in sfackler/r2d2-postgres#19, but I didn't want to stray that far from the beaten path so I ended up with this monstrosity: type ConnMgr = PostgresConnectionManager<Box<dyn MakeTlsConnect<Socket, TlsConnect=dyn Send, Stream=dyn Send, Error=dyn Error>>>; Now I'm just running into the same problem with [EDIT] - In the end I just stopped trying to own both of those in my own setup. This has made it really difficult to use -- implementing |
I have nothing to add here, but I just wanted to comment that as a beginner to Rust, the usage of this is very confusing. Even as an experienced programmer just getting into Rust, it's extremely annoying to be able to accept any generic type for If you go for the second option above, you run into a huge problem when having your own custom error enums when implementing the Would it not be possible to just have some underlying connection manager of some sort that is capable of using TLS and non-TLS connections? I'm not sure how the internals work, but surely it would be possible to have some sort of abstraction to make this possible? |
It might be possible to write enums that wrap over well-known types implementing |
Hi,
this issue is conceptually linked to sfackler/r2d2-postgres#19
The problem is related to the fact that the
PostgresConnectionManager<T>
struct has a generic parameter<T>
.If
<T>
is known at compile-time, then there are no problems; on the contrary, if it is only known at runtime then it has to be redeclared and propagated in every place where the connection and/or the Pool is used.As already shown in sfackler/r2d2-postgres#19 , it is possible to slightly alter the
PostgresConnectionManager
struct implementation to remove the genericT
and making the pool more ergonomic to use.If you think it is not feasible, would you at least mind to provide both the alternatives of the
PostgresConnectionManager
, one with and one without the generic param?The text was updated successfully, but these errors were encountered: