my_basic_crate 0.1.0

A basic crate made by Carlos Gonzalez
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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::Blue, PrimaryColor::Yellow) | (PrimaryColor::Yellow, PrimaryColor::Blue) => {
            SecondaryColor::Green
        }
        (PrimaryColor::Red, PrimaryColor::Blue) | (PrimaryColor::Blue, PrimaryColor::Red) => {
            SecondaryColor::Purple
        }
        _ => panic!("Cannot mix the same color with itself!"),
    }
}