Implementation of a deck of cards in rust.
Place the following in your Cargo.toml
file under [dependencies]
:
rs-deck-of-cards = { git = "https://github.com/EteimZ/rs_deck_of_cards" }
Then run cargo build
or cargo run
to build or run your project respectively.
Sample usage of the library:
use rs_deck_of_cards::Deck;
fn main() {
let mut deck = Deck::new();
// print the deck
deck.print();
// shuffle the deck
deck.shuffle();
// print the deck again
deck.print();
}
For a more comprehensive example, check this file.
The following APIs are available:
cards
- The main module that contains submodules:card
anddeck
.
Card
- Represents a card in the deck. It contains aSuit
and aValue
enum.Deck
- Represents a deck of cards.
Suit
- Represents the suit of a card.Value
- Represents the value of a card.