Follow

I am apparently too stupid to be able to make a method that returns a Stream of Result<Bytes> from a stream::unfold which does as async read of file chunks because I have no clue why the chunk read needs to be Send and what that even means

· · Web · 1 · 1 · 2

I threw a tokio::sync::mpsc::channel into the mix and did the un-Send-able stuff in a separate task. and it magically works now.

AHA! Apparently I can get around this by using `tokio::task::spawn_local` instead of `tokio::spawn` according to this response to a deleted reddit post from two years ago. Yes my life expectancy got reduced a little while trying to figure this out.

reddit.com/r/rust/comments/10x

@mauve I laughed when I saw this post because I have had this same argument with Rust multiple times. Best of luck!

@fabrefact I ended up inlining an async function I was calling until it worked 😅 Diverted into LocalSet for a bit which was less than fruitful

Sign in to participate in the conversation
Mauvestodon

Escape ship from centralized social media run by Mauve.