games/
lib.rs

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