Function xstream_util::xstream
source · pub fn xstream(
pool: &mut impl Pool,
in_handle: &mut impl BufRead,
delim: impl AsRef<[u8]>,
write_delim: &Option<impl AsRef<[u8]>>
) -> Result<(), Error>
Expand description
Stream one reader into several independent processes
in_handle
will be delimited by delim
, each section will be piped as stdin to a command spawned from pool
.
Notes
If the commands are io intensive or the buffer being piped to each command is long than there won’t be much parallelization as this must finish sending a section to a process before it will spin up another.
Errors
If there are problems spawning processes, the processes themselves fail, or there are problems reading or writing to the available readers / writers.