{"id":22292273,"url":"https://github.com/locka99/deckofcards-rs","last_synced_at":"2025-07-28T23:33:15.550Z","repository":{"id":57617114,"uuid":"54151472","full_name":"locka99/deckofcards-rs","owner":"locka99","description":"Deck of cards implemented in Rust","archived":false,"fork":false,"pushed_at":"2023-09-22T02:32:00.000Z","size":62,"stargazers_count":18,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-09T11:03:14.471Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/locka99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-17T21:05:30.000Z","updated_at":"2024-09-06T18:41:13.000Z","dependencies_parsed_at":"2022-08-29T05:31:39.249Z","dependency_job_id":null,"html_url":"https://github.com/locka99/deckofcards-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locka99%2Fdeckofcards-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locka99%2Fdeckofcards-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locka99%2Fdeckofcards-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locka99%2Fdeckofcards-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/locka99","download_url":"https://codeload.github.com/locka99/deckofcards-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227962935,"owners_count":17848016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T17:20:45.910Z","updated_at":"2024-12-03T17:20:46.428Z","avatar_url":"https://github.com/locka99.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deck of Cards\n\nThis is a simple library implemented in Rust that models a deck of cards. You can use it to create a deck, shuffle it,\ndeal cards one or multiple cards at a time.\n\n## Cargo import\n\nYou can use the module in the standard way by adding this to your Cargo.toml. Unless you have a reason not to, you should use the latest released version.\n\n```\n[dependencies]\ndeckofcards = \"0.4\"\n```\n\n## API documentation\n\nOnce you've added a dependency you can get class documentation like so:\n\n```\ncargo doc\n```\n\n## Usage\n\nThe Deck class contains zero or more Cards which are held in dealt or undealt piles. You can `shuffle()` the deck.\nYou can `deal_one()` card or `deal_many()` cards. You can `reset()` to return dealt cards to the undealt pile.\n\n```\nuse deckofcards::*;\n\nlet mut deck = Deck::new();\n```\n\nBy default if you don't shuffle, your deck will be sorted by suit then rank. You can shuffle the deck using a randomized\nKnuth shuffle:\n\n```\ndeck.shuffle();\n```\n\nYou can deal cards out to a `Vec\u003cCard\u003e`:\n\n```\nlet cards = deck.deal(5);\n```\n\nOr into the `Hand` object which provides additional sorting and filtering.\n\n```\nlet mut hand = Hand::new();\ndeck.deal(\u0026mut hand, 3);\n```\n\nEach card has a `Rank` and a `Suit`, both of which are strong enum types.\n\nCards can be compared, sorted and have helpers to print a long and short description using English notation, e.g. \"Ace of Spades\" or \"AS\".\n\n### Macros\n\nThe crate provides convenience `card!` and `hand!` macros for declaring cards or hands as text:\n\n```\n#[macro_use]\nextern crate deckofcards;\n\n//... A Card that is the King of Clubs\nlet card = card!(\"KC\");\n//... A Hand that is Ace of Spades, 3 of Diamonds, Queen of Clubs\nlet hand = hand!(\"AS\", \"3D\", \"QC\");\n```\n\n## Example\n\nThere is an example for you see how it works in `examples/main.rs`.\n\n```\ncargo run --example main\n```\n\n## Tests\n\nThere are some 30 or so unit tests.\n\n```\ncargo test\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocka99%2Fdeckofcards-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocka99%2Fdeckofcards-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocka99%2Fdeckofcards-rs/lists"}