So I'm trying to build a simple deck generator using Rust. I'm new to the language so I haven't grasped everything about it yet.
I want to iterate over both a Suits enum and a Values enum, make a Card struct using them, and then push that Card into the Deck's cards vector.
So far I tried making a static enum and iterating over that like this:
static SUITE_ITER: [Cards::Suits; 4] = [
Cards::Suits::HEARTS,
Cards::Suits::CLUBS,
Cards::Suits::DIAMONDS,
Cards::Suits::SPADES
];
for suit in SUITE_ITER.into_iter() {...}
However, I get this error message that I don't fully understand. Any tips?
cannot move out of static item SUITE_ITER
move occurs because SUITE_ITER
has type [Suits; 4]
, which does not implement the Copy
trait