1pub mod kinds {
6 #[derive(Debug, PartialEq)]
8 pub enum PrimaryColor {
9 Red,
10 Yellow,
11 Blue,
12 }
13
14 #[derive(Debug, PartialEq)]
15 pub enum SecondaryColor {
17 Orange,
18 Green,
19 Purple,
20 }
21}
22
23pub mod utils {
24 use crate::kinds::*;
25
26 pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
29 if c1 == PrimaryColor::Red && c2 == PrimaryColor::Yellow {
31 SecondaryColor::Orange
32 } else if c1 == PrimaryColor::Red && c2 == PrimaryColor::Blue {
33 SecondaryColor::Purple
34 } else if c1 == PrimaryColor::Yellow && c2 == PrimaryColor::Blue {
35 SecondaryColor::Green
36 } else {
37 panic!("Wrong colors: {:?} and {:?}! You should be ashamed of yourself.", c1, c2);
38 }
39 }
40}