1 unstable release
0.1.0 | Mar 18, 2021 |
---|
#400 in Simulation
9KB
100 lines
Ionic Deckhandler
Rust implementation of a deck creation and card shuffling library
Examples
use ionic_deckhandler::{Card, Deck};
let mut deck = Card::get_deck();
{
let first_card = &deck[0];
assert_eq!(
format!("{:?}", first_card.get_suit()),
String::from("Clubs")
);
}
deck.shuffle_deck();
for card in deck.iter() {
println!("{:?}", card);
}
deck.sort();
for card in deck.iter() {
println!("{:?}", card);
}
use ionic_deckhandler::{Card, Suit, Rank};
let card = Card::new(Rank::Five, Suit::Hearts);
let ucard_rank = Card::get_rank(&card) as usize;
let ucard_suit = Card::get_suit(&card) as usize;
use ionic_deckhandler::{Card, Suit, Rank};
let mut hand_arr = [
Card::new(Rank::Five, Suit::Hearts),
Card::new(Rank::Three, Suit::Hearts),
Card::new(Rank::Two, Suit::Hearts),
Card::new(Rank::Ace, Suit::Hearts),
Card::new(Rank::Four, Suit::Hearts),
];
hand_arr.sort();
Documentation
See docs.rs/ionic_deckhandler/ for generated API documentation.
Contributing
See CONTRIBUTING.md
Help and Support
- Issues
- Chat room
- Emails listed in Cargo.toml
Dependencies
~1.4–2MB
~36K SLoC