ionic_deckhandler

Crates.ioionic_deckhandler
lib.rsionic_deckhandler
version0.1.0
sourcesrc
created_at2021-03-18 00:34:42.983255
updated_at2021-03-18 00:34:42.983255
descriptionRust implementation of a deck creation and card shuffling library
homepagehttps://github.com/TelluricDeckay/ionic_deckhandler
repositoryhttps://github.com/TelluricDeckay/ionic_deckhandler
max_upload_size
id370318
size21,134
James Sherratt (Jammyjamjamman)

documentation

https://docs.rs/ionic_deckhandler

README

Rust crates-badge

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

Commit count: 21

cargo fmt