fox_rs/
lib.rs

1/// Adds one to the number given.
2///
3/// # Examples
4///
5/// ```
6/// let arg = 5;
7/// let answer = my_crate::add_one(arg);
8///
9/// assert_eq!(6, answer);
10/// ```
11pub fn add_one(x: i32) -> i32 {
12    x + 1
13}
14
15
16pub fn simple_print(msg: &str) {
17    println!("\n----------------- {} -----------------", msg);
18}
19
20pub mod kinds {
21    /// The primary colors according to the RYB color model.
22    pub enum PrimaryColor {
23        Red,
24        Yellow,
25        Blue,
26    }
27
28    /// The secondary colors according to the RYB color model.
29    pub enum SecondaryColor {
30        Orange,
31        Green,
32        Purple,
33    }
34}
35
36pub mod utils {
37    use crate::kinds::*;
38
39    /// Combines two primary colors in equal amounts to create
40    /// a secondary color.
41    /// Combines two primary colors in equal amounts to create
42    /// a secondary color.
43    pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
44        match c1 {
45            PrimaryColor::Red => SecondaryColor::Orange,
46            _other => SecondaryColor::Orange
47        };
48
49        match c2 {
50            PrimaryColor::Yellow => SecondaryColor::Green,
51            _other => SecondaryColor::Green
52        };
53
54        SecondaryColor::Purple
55    }
56}