1pub use self::kinds::PrimaryColor;
7pub use self::kinds::SecondaryColor;
8pub use self::utils::mix;
9
10pub mod kinds {
11 #[derive(PartialEq)]
13 pub enum PrimaryColor {
14 Red,
15 Yellow,
16 Blue,
17 }
18
19 pub enum SecondaryColor {
21 Orange,
22 Green,
23 Purple,
24 }
25}
26
27pub mod utils {
28 use crate::kinds::*;
29
30 pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
33 if c1 == PrimaryColor::Blue && c2 == PrimaryColor::Red {
34 return SecondaryColor::Purple;
35 }
36 SecondaryColor::Green
37 }
38}
39#[cfg(test)]
40mod tests {
41 #[test]
42 fn it_works() {
43 let result = 2 + 2;
44 assert_eq!(result, 4);
45 }
46}