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.
close #5
Note this constitutes a breaking change, and means only Rust>=1.85 is supported
Regarding the Rust>=1.85, another solution to avoid this would be to put async closure support under a feature.
This is a bit trick though: since
Faction::open
&TransactionBuilder::run
would have two flavors of signature.To do that there is basically three ways:
Faction::open
&TransactionBuilder::run
bodiesFaction::open
&TransactionBuilder::run
body inside a macro which is called in each flavor of the functionsFaction::open
&TransactionBuilder::run
internally calles the sync-closure -returning-futureSolution 3 seems the most elegant, however it only works because the async closure is
'static
.If that wasn't the case we would in theory need to use a
unsafe std::mem::transmute
to overwrite the lifetime of the async closure before passing it toopen_internal
... but even this doesn't work in practice:impl AsyncFnOnce()
into aimpl AsyncFnOnce() + 'static
cannot be expressed as far as I'm aware (as there is no way in telling the resultingimpl AsyncFnOnce() + 'static
have the same size than theimpl AsyncFnOnce()
provided as input)unsafe_jar::run
relies onwasm_bindgen::Closure::once
which itself requires the passed closure to be'static