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