I wanted to read a binary file into a stream so that I can pass it to an existing function
pub async fn foo(input_stream: &mut (impl Stream<Item = Vec<u8>> + Unpin))
I'm trying to read the file into an iterator, and then use
stream::iter() to adapt it into a stream, but I cannot find a method to read the file into an iterator:
lines() did not work because it's not a text file, and
bytes() iterator returns a single byte at a time. Did I miss something obvious?
Btw, I'm trying to do it using
std. (We're not using
tokio for async).