Remove card.rs #83

Closed
opened 2026-06-11 03:09:31 +00:00 by Quaternions · 1 comment

This file is vestigial. card_to_id is frankenstein jank, all usages of the u32 output should be replaced with the upstream Card type.

This file is vestigial. card_to_id is frankenstein jank, all usages of the u32 output should be replaced with the upstream Card type.
Owner

Resolved in commit e0a858d (branch refactor/strip-card_game-redundancies).

card_to_id (the 0..=51 frankenstein id) is removed and card.rs deleted. Replacements:

  • feedback_anim deal jitter: seeds off a hash of the Card itself, not a precomputed id.
  • radial_menu RightClickRadialState.cards: Vec<u32> -> Vec<Card>.
  • wasm CardSnapshot.id: u32 -> card_game::Card. Card is #[serde(transparent)] over NonZeroU8, so it still serialises as a plain JS number — the same opaque key the renderer already used (Map key / dataset.cardId; no arithmetic on it; faces render from rank+suit). A new test asserts card.id serialises as a JSON number.
  • wasm DebugInvariantReport deck-completeness check: reworked from a [bool;52] index into a HashSet<Card> + Card::new reference deck; the out-of-range check is dropped (a Card is always valid).

card.rs is gone: the Card/Deck/Rank/Suit re-exports moved to the crate root and the 69 solitaire_core::card:: import paths flattened to solitaire_core::.

cargo test --workspace (all crates green, incl. the wasm autonomous soak that exercises CardSnapshot + the invariant report) and clippy --workspace --all-targets -D warnings both pass.

Resolved in commit e0a858d (branch refactor/strip-card_game-redundancies). `card_to_id` (the 0..=51 frankenstein id) is removed and `card.rs` deleted. Replacements: - **feedback_anim** deal jitter: seeds off a hash of the `Card` itself, not a precomputed id. - **radial_menu** `RightClickRadialState.cards`: `Vec<u32>` -> `Vec<Card>`. - **wasm `CardSnapshot.id`**: `u32` -> `card_game::Card`. Card is `#[serde(transparent)]` over `NonZeroU8`, so it still serialises as a plain JS number — the same opaque key the renderer already used (Map key / `dataset.cardId`; no arithmetic on it; faces render from rank+suit). A new test asserts `card.id` serialises as a JSON number. - **wasm `DebugInvariantReport`** deck-completeness check: reworked from a `[bool;52]` index into a `HashSet<Card>` + `Card::new` reference deck; the out-of-range check is dropped (a `Card` is always valid). `card.rs` is gone: the `Card`/`Deck`/`Rank`/`Suit` re-exports moved to the crate root and the 69 `solitaire_core::card::` import paths flattened to `solitaire_core::`. `cargo test --workspace` (all crates green, incl. the wasm autonomous soak that exercises CardSnapshot + the invariant report) and `clippy --workspace --all-targets -D warnings` both pass.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#83