summaryrefslogtreecommitdiff
path: root/rust-book/crates/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust-book/crates/src/lib.rs')
-rwxr-xr-xrust-book/crates/src/lib.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/rust-book/crates/src/lib.rs b/rust-book/crates/src/lib.rs
new file mode 100755
index 0000000..5cf1d97
--- /dev/null
+++ b/rust-book/crates/src/lib.rs
@@ -0,0 +1,33 @@
+//! # Art
+//!
+//! A library for modeling artistic concepts.
+
+pub use kinds::PrimaryColor;
+pub use kinds::SecondaryColor;
+pub use utils::mix;
+
+pub mod kinds {
+ /// The primary colors according to the RYB color model.
+ pub enum PrimaryColor {
+ Red,
+ Yellow,
+ Blue,
+ }
+
+ /// The secondary colors according to the RYB color model.
+ pub enum SecondaryColor {
+ Orange,
+ Green,
+ Purple,
+ }
+}
+
+pub mod utils {
+ use crate::kinds::*;
+
+ /// Combines two primary color in equal amounts to create
+ /// a secondary color.
+ pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
+ SecondaryColor::Green
+ }
+}