Crates.io | ionic_deckhandler |
lib.rs | ionic_deckhandler |
version | 0.1.0 |
source | src |
created_at | 2021-03-18 00:34:42.983255 |
updated_at | 2021-03-18 00:34:42.983255 |
description | Rust implementation of a deck creation and card shuffling library |
homepage | https://github.com/TelluricDeckay/ionic_deckhandler |
repository | https://github.com/TelluricDeckay/ionic_deckhandler |
max_upload_size | |
id | 370318 |
size | 21,134 |
Rust implementation of a deck creation and card shuffling library
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();
See docs.rs/ionic_deckhandler/ for generated API documentation.
See CONTRIBUTING.md