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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.0 cannot use asynchronous copy_to_file? #283

Closed
gmg137 opened this issue Dec 31, 2020 · 3 comments · Fixed by #285
Closed

Version 1.0 cannot use asynchronous copy_to_file? #283

gmg137 opened this issue Dec 31, 2020 · 3 comments · Fixed by #285
Labels
bug Something is borken

Comments

@gmg137
Copy link

gmg137 commented Dec 31, 2020

hello, After I updated to version 1.0, I cannot use copy_to_file after get_async.

@gmg137
Copy link
Author

gmg137 commented Dec 31, 2020

Using copy_to directly will prompt : future is not Send as it awaits another future which is not Send.
The problem seems to be caused by CopyFuture.

@sagebind
Copy link
Owner

copy_to_file always was synchronous-only and should not be used in an asynchronous context. There is no async version of copy_to_file provided because std does not come with an asynchronous filesystem implementation, which is usually runtime-specific.

I think you are right though; CopyFuture ought to be Send if Response<T> is Send. This seems to be the same problem as #173 but must've been missed when it was fixed for text().

@sagebind sagebind added the bug Something is borken label Dec 31, 2020
sagebind added a commit that referenced this issue Dec 31, 2020
Add `ReadResponseExt::consume` and `AsyncReadResponseExt::consume` methods for reading and discarding a response bod as described in #257.

Also update future types used by `AsyncReadResponseExt` to be `Send` whenever `T` is `Send` as appropriate.

Fixes #257 and #283.
sagebind added a commit that referenced this issue Dec 31, 2020
Update future types used by `AsyncReadResponseExt` to be `Send` whenever `T` is `Send` as appropriate. Consolidate the newtype futures with a macro that handles conditional Send properly to reduce boilerplate and chance of mistakes.

Fixes #283.
sagebind added a commit that referenced this issue Dec 31, 2020
Update future types used by `AsyncReadResponseExt` to be `Send` whenever `T` is `Send` as appropriate. Consolidate the newtype futures with a macro that handles conditional `Send` properly to reduce boilerplate and chance of mistakes.

Fixes #283.
@sagebind
Copy link
Owner

This has been fixed in 1.0.1!

caspermeijn pushed a commit to caspermeijn/read-it-later that referenced this issue Jan 24, 2023
Update isahc. As part of this we need to convert copy_to_file() to not
be async due to: sagebind/isahc#283

Signed-off-by: Alistair Francis <alistair@alistair23.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is borken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants