Skip to content

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 🤷

sd2k added 2 commits November 3, 2022 22:42
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.

1 participant