closure_demon/
lib.rs

1
2
3//! # My Crate
4//! `my crate` is a collection of utilities to make ...
5//! calculations more convenient
6
7/// Adds one to the number given.
8/// 包括如何使用add_one 方法来进行数据的加操作
9/// # Examples
10/// ```
11/// let arg=5;
12/// let answer =closure::add_one(arg);
13/// assert_eq!(6,answer);
14/// ```
15
16pub fn add_one(x:i32)->i32{
17    x+1
18}
19
20
21
22
23pub use crate::kinds::PrimaryColor;
24pub use crate::kinds::SecondaryColor;
25pub use crate::utils::mix;
26
27
28pub mod kinds{
29    pub enum PrimaryColor{
30        Red,
31        Yellow,
32        Blue,
33    }
34
35    pub enum SecondaryColor{
36        Orange,
37        Green,
38        Purple,
39    }
40
41}
42
43
44pub mod utils{
45    use crate::kinds;
46    use crate::kinds::{PrimaryColor, SecondaryColor};
47
48    pub fn mix(c1:PrimaryColor,c2:PrimaryColor)->SecondaryColor{
49        SecondaryColor::Green
50    }
51
52}