0

With this definition of Strct, it is possible for values to hold any variant of the Test enum:

enum Test {
    A,
    B,
    C,
}

struct Strct {
    values: Vec<Test>,
}

Is there a way to enforce it to hold only a specific variant of the enum? E.g. Vec<A> or Vec<B> or Vec<C> for that specific case.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
Some Name
  • 8,555
  • 5
  • 27
  • 77

0 Answers0