You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tokio Runtime is usually multi-threaded, meaning that at any .await point your task could get moved from one thread to another. That's why everything that is held across an .await point must be Send.
I also intend to use in async_trait methods, which by default require Send.
However, many structs in debian-packaging are not Send. For example, I want to unpack data_tar_reader inside BinaryPackageEntry, which causes errors like this:
error: future cannot be sent between threads safely
..... some code here
| |_____^ future created by async block is not `Send`
|
= help: the trait `std::marker::Send` is not implemented for `(dyn futures::AsyncRead + Unpin + 'static)`
note: future is not `Send` as this value is used across an await
241 | while let Some(Ok(e)) = a.next_entry() {
| - has type `BinaryPackageEntry` which is not `Send`
...
282 | data_tar_reader.into_inner().unpack(&dst).await?;
| ^^^^^ await occurs here, with `e` maybe used later
The text was updated successfully, but these errors were encountered:
Qutting https://stackoverflow.com/questions/75079221/future-created-by-async-block-is-not-send
I also intend to use in
async_trait
methods, which by default require Send.However, many structs in
debian-packaging
are notSend
. For example, I want to unpackdata_tar_reader
insideBinaryPackageEntry
, which causes errors like this:The text was updated successfully, but these errors were encountered: