cargo_crates_htl/
lib.rs

1//! # My Crate
2//!
3//! `my_crate` is a collection of utilities to make performing certain
4//! calculations more convenient.
5/// Adds one to the number given.
6///
7/// # Examples
8///
9/// ```
10/// let arg = 5;
11/// let answer = cargo_crates_htl::add_one(arg);
12///
13/// assert_eq!(6, answer);
14/// ```
15pub fn add_one(x: i32) -> i32 {
16    x + 1
17}
18
19
20pub use self::kinds::PrimaryColor;
21pub use self::kinds::SecondaryColor;
22pub use self::utils::mix;
23
24
25pub mod kinds {
26    /// The primary colors according to the RYB color model.
27    pub enum PrimaryColor {
28        Red,
29        Yellow,
30        Blue,
31    }
32
33    /// The secondary colors according to the RYB color model.
34    pub enum SecondaryColor {
35        Orange,
36        Green,
37        Purple,
38    }
39}
40
41pub mod utils {
42    use crate::kinds::*;
43
44    /// Combines two primary colors in equal amounts to create
45    /// a secondary color.
46    pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
47        SecondaryColor::Green
48    }
49}