I recently came across a situation where I had to push multiple vectors of thread handles to a central vector.
The first element that I was adding to the central thread comes as follows;
// This works.
// `example_crate::make()` returns a `std::thread::JoinHandle<()>`;
let mut threads = vec![example_crate::make()];
Now, I had another function which returns a vector of thread handles, if I wanted to push the elements of the return value to the threads
variable, I would do;
// This works.
let mut threads = vec![example_crate::make()];
// `second_example_crate::make()` returns a `Vec<std::thread::JoinHandle<()>`;
threads.extend(second_example_crate::make());
My proposition is a struct like dot dot operator for expanding the elements of compatible vector types to the central vector (at initialization) in the following syntax;
// This currently does not work.
let mut threads = vec![example_crate::make(), ..second_example_crate::make()];