ripgrep-all/src/recurse.rs

18 lines
549 B
Rust
Raw Normal View History

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-12-05 03:30:56 +00:00
pub fn concat_read_streams(input: AdaptedFilesIterBox) -> 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 {
2022-12-26 17:58:17 +00:00
let o = output.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?.inp;
let stream = ReaderStream::new(o);
2022-10-30 00:34:56 +00:00
for await bytes in stream {
2022-10-29 18:54:05 +00:00
yield bytes;
}
}
};
Box::pin(StreamReader::new(s))
2022-12-05 03:30:56 +00:00
}