1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//! # Hodgepodge
//!
//! `hodgepodge` bundles ready-made enums you can drop into lessons,
//! prototypes, demos, and coding exercises. Each enum doubles as a small dataset
//! (CSS color keywords, RGB swatches, the periodic table, geography trivia, game
//! pieces, etc.) so you can focus on explaining a concept instead of inventing
//! sample data.
//!
//! Bring everything into scope with `use hodgepodge::*;`, then iterate over the
//! variants (with the `strum` feature), format their values, or serialize them
//! (with the `serde` feature) depending on what the example calls for.
//!
//! ## Feature-gated helpers
//!
//! * `strum` – derives [`strum_macros::EnumIter`] and
//! [`strum_macros::EnumCount`] for every dataset, re-exporting
//! [`IntoEnumIterator`] and [`EnumCount`] so you can iterate over or count the
//! variants without depending on `strum` directly.
//! * `enum-iter` / `enum-count` – legacy compatibility feature names that now
//! simply forward to `strum`.
//! * `serde` – derives [`serde::Serialize`] and [`serde::Deserialize`] so the
//! enums can be persisted in fixtures for tutorials or quick prototypes.
//!
//! ## Examples
//!
//! ### Iterate through datasets
//! ```rust
//! # #[cfg(feature = "strum")]
//! # {
//! use hodgepodge::{Element, IntoEnumIterator};
//!
//! for element in Element::iter() {
//! let atomic_number = element as u16;
//! println!("{element:?} is element {atomic_number}");
//! }
//! # }
//! # #[cfg(not(feature = "strum"))]
//! # {
//! # // Enable the `strum` feature to run this example.
//! # }
//! ```
//!
//! ### Format CSS color hex values
//! ```rust
//! use hodgepodge::CSS;
//!
//! let swatch = CSS::Tomato;
//! println!("{swatch:?} renders as #{swatch:06x}");
//! ```
//!
//! ### Serialize and deserialize enums
//! ```rust
//! # #[cfg(feature = "serde")]
//! # {
//! use hodgepodge::Day;
//!
//! let json = serde_json::to_string(&Day::Friday).expect("serialize Day");
//! let day: Day = serde_json::from_str(&json).expect("deserialize Day");
//! assert_eq!(day, Day::Friday);
//! # }
//! # #[cfg(not(feature = "serde"))]
//! # {
//! # // Enable the `serde` feature to run this example.
//! # }
//! ```
/// Color palettes ranging from ROYGBIV to CSS keywords.
pub use *;
/// Science-themed datasets such as planets and SI prefixes.
pub use *;
/// Geographic datasets covering continents, regions, and states.
pub use *;
/// Temporal datasets including months and weekdays.
pub use *;
/// Games and leisure datasets like playing card suits and ranks.
pub use *;
/// Miscellaneous grab-bag datasets for playful examples.
pub use *;
/// Re-export helper traits from `strum` when the relevant feature is enabled.
pub use ;