pub mod kinds {
pub enum PrimaryColor {
Red,
Yellow,
Blue,
}
#[derive(Debug)]
pub enum SecondaryColor{
Orange,
Green,
Purple,
}
}
pub mod utils {
use crate::kinds::*;
pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor{
match (c1, c2) {
(PrimaryColor::Red, PrimaryColor::Yellow) |
(PrimaryColor::Yellow, PrimaryColor::Red) => SecondaryColor::Orange,
(PrimaryColor::Red, PrimaryColor::Blue) |
(PrimaryColor::Blue, PrimaryColor::Red) => SecondaryColor::Purple,
(PrimaryColor::Yellow, PrimaryColor::Blue) |
(PrimaryColor::Blue, PrimaryColor::Yellow) => SecondaryColor::Green,
(_, _) => SecondaryColor::Purple,
}
}
}