project14/lib.rs
1//! #Art
2//!
3//! A library for modeling artistic concepts.
4//! 一个用来建模艺术概率的代码库
5
6pub use self::kinds::PrimaryColor;
7pub use self::kinds::SecondaryColor;
8pub use self::utils::mix;
9
10pub mod kinds {
11 /// RYB颜色模型的三原色
12
13 #[derive(Debug)]
14 pub enum PrimaryColor {
15 Red,
16 Yellow,
17 Blue,
18 }
19
20 /// RYB模型的调和色
21
22 #[derive(Debug)]
23 pub enum SecondaryColor {
24 Orange,
25 Green,
26 Purple,
27 }
28}
29
30pub mod utils {
31 use crate::kinds::*;
32
33 //将两种等量的原色混合生成调和色
34 pub fn mix(c1: PrimaryColor, c2: SecondaryColor) -> SecondaryColor {
35 println!("{:?}--{:?}",c1,c2);
36 SecondaryColor::Green
37 }
38}