Input: add ChildContainer::new (#108)

This commit is contained in:
Miles Frankel
2022-01-12 05:58:59 -05:00
committed by GitHub
parent 00295bd3be
commit ecc47d588a

View File

@@ -20,7 +20,15 @@ use tracing::debug;
#[derive(Debug)]
pub struct ChildContainer(Vec<Child>);
pub(crate) fn children_to_reader<T>(children: Vec<Child>) -> Reader {
impl ChildContainer {
/// Create a new [`ChildContainer`] from a child process
pub fn new(children: Vec<Child>) -> Self {
Self(children)
}
}
/// Create a [`Reader`] from a child process
pub fn children_to_reader<T>(children: Vec<Child>) -> Reader {
Reader::Pipe(BufReader::with_capacity(
STEREO_FRAME_SIZE * mem::size_of::<T>() * CHILD_BUFFER_LEN,
ChildContainer(children),