Skip to content

refactor(core): Remove lifetime parameter from Arguments trait #3960

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

iamjpotts
Copy link
Contributor

@iamjpotts iamjpotts commented Aug 2, 2025

  • Simplifies the Arguments trait by removing the lifetime parameter
  • Removal of lifetime parameter causes the query! macro's println! similar usage to be enforced at compile time across all Database implementations.

Builds on #3958.

New commits with this pr are the last two:

  • refactor(core): Remove lifetime parameter from Arguments trait
  • refactor(core): Also relax lifetime of argument passed to Query::bind and Query::try_bind

Does your PR solve an issue?

No, but it standardizes that all argument buffers own their data, which means that we also standardize how references can be used when passing bind parameters to query! macros so it is similar to the println! macro. Previous to #3957, only the Postgres and MySQL drivers allowed the query! macro to be similar to the println! macro.

This ensures the flexibility of the Postgres driver is also supported with other drivers by preventing the introduction of a lifetime constraint to their implementation-specific argument buffer containers.

Is this a breaking change?

Yes - removes lifetime argument on two traits that are a part of the public api (Arguments and ArgumentBuffer) and makes cascading changes to query related traits and the Encode trait.

@iamjpotts iamjpotts changed the title Jp/arguments trait lifetime refactor(core): Remove lifetime parameter from Arguments trait Aug 2, 2025
@iamjpotts iamjpotts force-pushed the jp/arguments-trait-lifetime branch from 90f2291 to e3d86a3 Compare August 10, 2025 17:57
@iamjpotts iamjpotts force-pushed the jp/arguments-trait-lifetime branch 2 times, most recently from b362646 to 7bda390 Compare August 19, 2025 22:21
@iamjpotts iamjpotts marked this pull request as ready for review August 19, 2025 22:37
@iamjpotts iamjpotts force-pushed the jp/arguments-trait-lifetime branch 3 times, most recently from b22e0ea to 9a42171 Compare August 22, 2025 02:00
@iamjpotts iamjpotts force-pushed the jp/arguments-trait-lifetime branch from 9a42171 to 2646f3d Compare August 22, 2025 12:31
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.

1 participant