dontuse_this_002/lib.rs
1//! # Art
2//!
3//! A lib for modeling artistic concepts.
4
5pub use self::kinds::PrimaryColor;
6pub use self::kinds::SecondaryColor;
7pub use self::utils::mix;
8
9pub mod kinds {
10 pub enum PrimaryColor {
11 Red,
12 Yellow,
13 Blue
14 }
15
16 pub enum SecondaryColor {
17 Orange,
18 Green,
19 Blue
20 }
21}
22
23pub mod utils {
24 use crate::kinds::*;
25
26 pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
27 SecondaryColor::Blue
28 }
29}
30
31
32
33/// ! # My crate
34/// !
35/// ! `my_crate` is a collection of utilties to makeperfomaing ertain
36/// ! calculation more convienent
37/// ! 맨처음에 나와야함
38
39
40/// adds one to the number given
41///
42/// # Examples
43/// cargo test에서 예제코드도 같이 테스트된다.
44///
45///
46/// ```
47/// let arg = 5;
48/// let answer = ch14_publish-crate::add_one(arg);
49///
50/// assert_eq!(6, answer);
51/// ```
52
53pub fn add_one(x: i32) -> i32 {
54 x + 1
55}
56
57
58