bchx_cargo_extras/
lib.rs

1//! # Cargo Extras
2//!
3//! I wrote this example while following along with the
4//! rust book from this chapter - [https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#commenting-contained-items](Comenting Contained Items)
5//!
6//! `cargo_extras` is a collection of utilities to make
7//! calculations more convenient.
8//!
9//! There is also now an example about art and pub mod
10//!
11
12pub use self::kinds::PrimaryColor;
13pub use self::kinds::SecondaryColor;
14pub use self::utils::mix;
15
16pub mod kinds {
17    pub enum PrimaryColor {
18        Red,
19        Yellow,
20        Blue,
21    }
22
23    pub enum SecondaryColor {
24        Orange,
25        Green,
26        Purple,
27    }
28}
29
30pub mod utils {
31    use crate::kinds::*;
32
33    pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
34        unimplemented!("Mix da collahs")
35    }
36}
37
38/// Adds one to the number given.
39///
40/// # Examples
41///
42/// ```
43/// let arg = 5;
44/// let answer = cargo_extras::add_one(arg);
45///
46/// assert_eq!(answer, 6);
47/// ```
48pub fn add_one(x: i32) -> i32 {
49    x + 11
50}
51
52#[cfg(test)]
53mod tests {
54    // use crate::add_one;
55    #[test]
56    fn it_works() {
57        // let result = 2 + 2;
58        // assert_eq!(result, 4);
59
60        // let arg = 5;
61        // let answer = add_one(arg);
62
63        // assert_eq!(answer, 6);
64    }
65}