2022-10-29 18:54:05 +00:00
|
|
|
use tokio_util::io::{ReaderStream, StreamReader};
|
|
|
|
|
2020-09-30 15:26:42 +00:00
|
|
|
use crate::{adapted_iter::AdaptedFilesIterBox, adapters::*};
|
2022-10-29 18:54:05 +00:00
|
|
|
use async_stream::stream;
|
2020-09-30 14:22:54 +00:00
|
|
|
|
2022-10-30 00:34:56 +00:00
|
|
|
|
2022-10-29 18:54:05 +00:00
|
|
|
pub fn concat_read_streams(
|
2022-10-30 00:34:56 +00:00
|
|
|
input: AdaptedFilesIterBox,
|
2022-10-29 21:56:25 +00:00
|
|
|
) -> ReadBox {
|
2022-10-29 18:54:05 +00:00
|
|
|
let s = stream! {
|
2022-10-30 00:34:56 +00:00
|
|
|
for await output in input {
|
|
|
|
let stream = ReaderStream::new(output.inp);
|
|
|
|
for await bytes in stream {
|
2022-10-29 18:54:05 +00:00
|
|
|
yield bytes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
Box::pin(StreamReader::new(s))
|
2022-10-30 00:34:56 +00:00
|
|
|
}
|