pub fn add(left: u64, right: u64) -> u64 {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
pub use kinds::PrimaryColor;
pub use kinds::SecondaryColor;
pub use utils::mix;
pub mod kinds {
#[derive(Debug)]
pub enum PrimaryColor {
Red,
Yellow,
Blue,
}
#[derive(Debug)]
pub enum SecondaryColor {
Orange,
Green,
Purple,
}
}
pub mod utils {
use super::kinds::*;
pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
match (c1, c2) {
(PrimaryColor::Red, PrimaryColor::Yellow) => SecondaryColor::Orange,
(PrimaryColor::Yellow, PrimaryColor::Blue) => SecondaryColor::Green,
(PrimaryColor::Blue, PrimaryColor::Red) => SecondaryColor::Purple,
_ => panic!("Invalid color combination"),
}
}
}