pub fn add_one(x: i32) -> i32 {
x + 1
}
pub use self::kinds::PrimaryColor;
pub use self::kinds::SecondaryColor;
pub use self::utils::mix;
pub mod kinds {
#[derive(Debug, PartialEq)]
pub enum PrimaryColor {
Red,
Yellow,
Blue,
}
#[derive(Debug, PartialEq)]
pub enum SecondaryColor {
Orange,
Green,
Purple,
}
}
pub mod utils {
use crate::kinds::{PrimaryColor, SecondaryColor};
pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> Option<SecondaryColor> {
match (c1, c2) {
(PrimaryColor::Red, PrimaryColor::Yellow) | (PrimaryColor::Yellow, PrimaryColor::Red) => {
Some(SecondaryColor::Orange)
}
(PrimaryColor::Red, PrimaryColor::Blue) | (PrimaryColor::Blue, PrimaryColor::Red) => {
Some(SecondaryColor::Purple)
}
(PrimaryColor::Yellow, PrimaryColor::Blue) | (PrimaryColor::Blue, PrimaryColor::Yellow) => {
Some(SecondaryColor::Green)
}
_ => None, }
}
}