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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GATs in DataService #89

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Use GATs in DataService #89

wants to merge 2 commits into from

Conversation

sd2k
Copy link
Collaborator

@sd2k sd2k commented Nov 4, 2022

This makes the DataService::Stream associated type generic over a lifetime bound by Self. This means users can borrow data from self in their implementations even if they reference it in the futures of their stream. TBC whether this is actually worth doing 馃し

This should allow users to use `&self` in closures or generators when
iterating over the queries in the request, for example. Previously all
closures/async blocks would have needed to own their data but now we can
express to the compiler that `Self` will outlive the output stream
:tada:
This is a bit of a tradeoff: users may need to clone aspects of the request
if they want to use it for every query in request.queries(), since the futures
they return need to outlive the request (and so must own the parts they need).
It does mean that users have ownership of the request again though... is that needed?
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.

None yet

1 participant