games/
lib.rs

1#![doc(html_root_url = "https://docs.rs/games-rs/0.4.0")]
2//! Pre implemented games
3#![deny(
4    missing_copy_implementations,
5    missing_debug_implementations,
6    missing_docs,
7    trivial_casts,
8    trivial_numeric_casts,
9    unused_extern_crates,
10    deprecated,
11    overflowing_literals,
12    unreachable_patterns,
13    unused_must_use,
14    unused_mut,
15    while_true
16)]
17#![warn(unreachable_pub, variant_size_differences)]
18
19pub mod blackjack;
20pub mod cards;
21pub mod coin_toss;
22pub mod color;
23pub mod deck;
24// Static deck of cards
25pub(crate) mod deck_of_cards;
26pub mod errors;
27pub mod rps;
28pub mod slot_machine;
29
30pub mod solitaire; // TODO: Improve performance
31
32#[cfg(feature = "small_rng")]
33use rand::SeedableRng;
34
35#[cfg(not(feature = "small_rng"))]
36pub(crate) fn get_rng() -> rand::rngs::ThreadRng {
37    rand::rng()
38}
39#[cfg(feature = "small_rng")]
40pub(crate) fn get_rng() -> rand::rngs::SmallRng {
41    // Once per thread
42    let mut thread_rng = rand::rng();
43    rand::rngs::SmallRng::from_rng(&mut thread_rng).expect("Assume this won't fail.")
44}
45
46// TODO: Cleanup codebasgg
47// TODO: each game a feature