Skip to content

EteimZ/rs_deck_of_cards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Deck of cards

Implementation of a deck of cards in rust.

Installation

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.

Usage

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.

API

The following APIs are available:

Modules

  • cards - The main module that contains submodules: card and deck.

Structs

  • Card - Represents a card in the deck. It contains a Suit and a Value enum.
  • Deck - Represents a deck of cards.

Enums

  • Suit - Represents the suit of a card.
  • Value - Represents the value of a card.

About

Implementing a deck of cards in rust

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages