funman300 0cdfa5446a feat(card_game): add optional serde feature for Deck, Suit, Rank, Card
Adds a `serde` Cargo feature that gates #[derive(Serialize, Deserialize)]
on the four primitive types: Deck, Suit, Rank, and Card.

- Deck / Suit / Rank: plain enum derives — serialize as variant name strings
- Card: newtype over NonZeroU8 with #[serde(transparent)], serializes as
  the raw packed byte (deck<<6 | suit<<4 | rank)

Without the feature the crate remains no_std-compatible and pulls no
additional dependencies. With it, serde 1.x (derive only, no std) is
added as an optional dep.

Downstream consumers enable with:
  card_game = { ..., features = ["serde"] }
2026-06-08 10:49:53 -07:00
2026-05-16 12:58:07 -07:00
2026-05-29 17:08:57 -07:00
2026-05-29 17:43:04 -07:00
2026-05-15 06:05:11 -07:00
2026-05-29 14:54:18 -07:00
2026-05-29 14:54:18 -07:00
2026-05-29 16:16:16 -07:00
2026-05-15 06:05:11 -07:00

Card Game

card_game is a collection of algorithms, structs, and enums which are useful to implement card games.

Example

use card_game::{Card, Deck, Rank, Stack, Suit};

// create a full deck (unshuffled)
let mut deck = Stack::full_deck(Deck::Deck1);

// inspect the top card
let card = deck.pop().unwrap();
assert_eq!(card, Card::new(Deck::Deck1, Suit::Diamonds, Rank::King));

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
S
Description
No description provided
Readme 1 MiB
Languages
Rust 100%