This is really hard to explain concisely. But what I want is a struct that has a field of Vec "A" containing a vector of threads with another Vec "B" inside the Vec "A". Vec "A" holds both the Vec "B" and thread handle. Vec "B" has a uniform type, no need for trait objects, but Vec "A" holds multiple different types of Vec "B" using trait objects. Basically I don't want to use trait objects for Vec "B" but use trait objects for Vec "A".
I tried to implement the above but it doesn't always feel right and errors. Is there any actual implementation of this or any direct workaround of this?
I did tried searching it but I feel like I can't word it concisely without writing a short paragraph to Google.
Here's the (pseudo-)code of what I think it should be like:
trait Tag {}
impl Tag for u32 {}
impl Tag for i64 {}
// Vec "B"
type InnerVec<T: Tag> = Vec<T>;
struct ThreadPool {
// Vec "A"
threads: Vec<(JoinHandle<()>, InnerVec<dyn Tag>)>,
}