I would like to know the ways to have a container containing several types. I know that:
- A tuple can contain several types
- If I create an enumeration
E
, I can create aVec<E>
.
In C++, we can create a Vec<A*>
containing both B*
and C*
elements if B
and C
inherit from A
. Can we do something similar in Rust? For instance, if several types implement the same trait?