Skip to content

implement generic key for no feature flag #12

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

Closed
wants to merge 1 commit into from

Conversation

EItanya
Copy link

@EItanya EItanya commented Nov 30, 2022

This PR attempts to make the client pooling Key generic so that the caller can decide how they wish to pool the client connections.

As of writing, it does not work with the tokio runtime, I am relatively new to rust and was having some issues getting on of the futures functions to play nicely, would love so help.

Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

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

Looks pretty on point, just one thought inline.

@@ -42,6 +43,8 @@ pub(super) trait Poolable: Unpin + Send + Sized + 'static {
fn can_share(&self) -> bool;
}

pub trait Key: Eq + Hash + Clone + Debug + Unpin {}
Copy link
Member

Choose a reason for hiding this comment

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

Do we need the separate trait?

It looks like this may exist just to reduce the list at K: Eq + Hash + .... But if the trait doesn't provide anything new, it would provide a hurdle to users: they'd need to impl Key for MyThing. That'd be more annoying if MyThing were from a different crate, so they couldn't implement it.

Copy link
Author

@EItanya EItanya Dec 8, 2022

Choose a reason for hiding this comment

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

That's a great point, new to Rust things!!

Copy link
Contributor

Choose a reason for hiding this comment

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

@seanmonstar we could do a blanket implementation? Or do you prefer putting all the individual traits on each bounds?

@howardjohn
Copy link
Contributor

FYI: I moved this over to #16 since I don't have permission to push to this fork but am taking over the work. Apologies for the noise

@EItanya EItanya closed this Dec 15, 2022
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.

Allow for generic Keys in connection pooling.
3 participants