rust - What ways exist to create containers of several types? -
this question has answer here:
i know ways have container containing several types. know that:
- a tuple can contain several types
- if create enumeration
e
, can createvec<e>
.
in c++, can create vec<a*>
containing both b*
, c*
elements if b
, c
inherit a
. can similar in rust? instance, if several types implement same trait?
1) can store references or pointers trait objects.
2) can create enum on things want store.
Comments
Post a Comment