Add Send bound to streams. #471
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had to dig a bit into the different
QueryStream
implementations and the only reason for!Send
I could find was the builder function passed to the builder in theouroboros
context. Theself_referencing
macro generates a signature on the current release ofouroboros
that allows!Send
constructors:https://github.com/joshua-maros/ouroboros/blob/main/ouroboros_macro/src/info_structures.rs#L265
I forkedouroboros
and added theSend
bound on the constructor future and replaced the crates.io dependency with one pointing at my branch. After fixing up theSend
requirements on theTransactionStream
, a few other places in this crate needed+ Send
bounds.This PR is not meant to be merged, it's mostly for documentation / demonstration of what would be required to get streams working intokio::spawn
context. If you're interested in getting this PR into better shape, we'll have to get into touch with theouroboros
maintainers to figure out if the missingSend
bound is intentional.I just recognized that
TransactionStream::build
can use a synchronous builder since the builder closure doesn't await any futures. That means the change onouroboros
is not even required to enableSend
streams.The first commit here is a solution that keeps the async constructor, the second one just removes the unused future on build