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

Remove Send trait bounds from argument bind() calls #2959

Closed
bobozaur opened this issue Jan 2, 2024 · 0 comments · Fixed by #2960
Closed

Remove Send trait bounds from argument bind() calls #2959

bobozaur opened this issue Jan 2, 2024 · 0 comments · Fixed by #2960
Labels
enhancement New feature or request

Comments

@bobozaur
Copy link
Contributor

bobozaur commented Jan 2, 2024

Is your feature request related to a problem? Please describe.
I wondered about the Send trait bounds required when binding arguments to, say, a Query, because it is the only thing preventing things like an Encode impl for std::fmt::Arguments.

While there's the Text adapter, it relies on a Display impl, so you need a dedicated type with a given Display impl to encode a message. std::fmt::Arguments is more dynamic, but it is not Send.

Describe the solution you'd like
I experimented with removing Send from the various bind() like methods and things seem to still work. The arguments buffer still is and probably needs to be Send, but arguments passed in bind() calls and encoded away don't really seem to need to be thread-safe, as the encoding is a sync operation.

Text could then in fact even rely on the Encode impl of std::fmt::Arguments.

Describe alternatives you've considered
Leave things as they are. It's not a big deal, but just a bit more performance and flexibility in encoding formatted messages without allocations.

Additional context
N/A.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant