my_crate_li 0.1.0

A simple Rust crate for demonstration purposes
Documentation
//! # my_crate_li
//! This is a simple crate that provides a function to add two numbers.

/// Add two numbers.
///
/// # Examples
///
/// ```
/// let result = my_crate_li::add(2, 3);
///
/// assert_eq!(result, 5);
/// ```
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 {
  /// The primary colors according to the RYB color model.
  #[derive(Debug)]
  pub enum PrimaryColor {
    Red,
    Yellow,
    Blue,
  }

  /// The secondary colors according to the RYB color model.
  #[derive(Debug)]
  pub enum SecondaryColor {
    Orange,
    Green,
    Purple,
  }
}

pub mod utils {
  use super::kinds::*;

  /// Combines two primary colors in equal amounts to create a secondary color.
  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"),
    }
  }
}