fix: disallow now_or_never (and async read
)
#105
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.
Tokio might preempt tasks at any point so
now_or_never
might returnNone
. See https://tokio.rs/blog/2020-04-preemptionWe could try to workaround this by using data structures from
futures
instead of
tokio
which to not hook into the tokio cooperativescheduling. However this has certain drawbacks
should rather work with it instead of against it.
futures
data structures don't participate incooperative scheduling is only because currently they cannot interact
with the runtime in any way. This might change when Rust's async
ecosystem evolves so it kinda seems like a non-future-proof
workaround.
Fixes #102.
While I'm on it I also disallowed async
read
because it has the same issue as thewrite
counterpart that we've already run into.