pub fn read_into<R: Read>(
open: impl FnOnce() -> Opened<R> + Send + 'static,
stop: impl Fn() -> bool,
write: impl FnMut(&[u8]) -> Result<()>,
) -> Result<u64, StreamError>Expand description
Run open on its own thread and pass each chunk to write here, in order, returning
the bytes written (a stated length must match). Reads run at most QUEUED_CHUNKS
ahead; a silent server holds the reader, not this thread, with stop checked between
chunks and every STALL_CHECK. The reader ends at its next chunk once this side goes.