Open recmo opened 3 years ago
FWIW, the reader I'm providing is Send and if I use the following unsafe hack to force the Future to be Send it appears to be working:
pub struct ForceSendFuture<F: Future>(F);
impl<F: Future> Future for ForceSendFuture<F> {
type Output = F::Output;
fn poll(
self: Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Self::Output> {
// See <https://doc.rust-lang.org/std/pin/index.html#projections-and-structural-pinning>
let inner = unsafe { self.map_unchecked_mut(|s| &mut s.0) };
inner.poll(cx)
}
}
unsafe impl<F: Future> Send for ForceSendFuture<F> {}
pub unsafe fn unsafe_force_send<F: Future>(future: F) -> ForceSendFuture<F> {
ForceSendFuture(future)
}
Thanks for the heads-up! I have added the respective trait bounds whereever dyn-traits are used and published the storage 1 crate as version 2.0.8. Maybe now it works :).
I am having this same problem using google_drive3
crate (using latest version "2.0.7+20210322")
@Rudo2204 drive3 was just re-released with the fixes. I have been hesitant to re-release all crates but might as well do that as the recent improvements seem to have made it worth it.
@Byron I have just updated and it works now! Thank you. The next question is how I am gonna play around the google drive quota limitation... :smile:
Using version https://crates.io/crates/google-storage1/2.0.7+20210330 which has #294 fixed.
With the new error I'm still not able to do an upload in a Future that is Send (i.e. inside
tokio::spawn
):