sfackler / r2d2

A generic connection pool for Rust
Apache License 2.0
1.49k stars 80 forks source link

Add a PooledConnection::pool() method #146

Closed pjenvey closed 11 months ago

pjenvey commented 11 months ago

A method returning the parent Pool of a PooledConnection could be a useful addition. e.g. deadpool supports this.

sfackler commented 11 months ago

What's the use case for this?

pjenvey commented 11 months ago

Great question, which in retrospect, makes me consider this issue likely invalid.

A use case for deadpool's pool method is the ability to access the connection Pool's Manager instance, which is somewhat similar to r2d2::ManageConnection. This could be used to e.g. retrieve a Pool level configuration stored on the Manager instance from the connection itself.

r2d2::Pool doesn't currently provide access to its manager like this, so this use case isn't applicable to r2d2 AFAICT.

sfackler commented 11 months ago

I'd like to see a concrete use case before adding a feature.