summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author53hornet <53hornet@gmail.com>2019-03-22 21:47:54 -0400
committer53hornet <53hornet@gmail.com>2019-03-22 21:47:54 -0400
commitfca68dfe8b49914d13f29706522cb0d3ad80a390 (patch)
treea36175ce0d80b2613da79461de15fef055a8158e
parentb1ea85616e4367713afbeabb6cfb6ae553c17a60 (diff)
downloadlearning-rust-fca68dfe8b49914d13f29706522cb0d3ad80a390.tar.xz
learning-rust-fca68dfe8b49914d13f29706522cb0d3ad80a390.zip
Added crates module (?)
-rw-r--r--crates/Cargo.toml7
-rw-r--r--crates/src/lib.rs33
-rw-r--r--crates/src/main.rs8
3 files changed, 48 insertions, 0 deletions
diff --git a/crates/Cargo.toml b/crates/Cargo.toml
new file mode 100644
index 0000000..202ff1d
--- /dev/null
+++ b/crates/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "crates"
+version = "0.1.0"
+authors = ["53hornet <53hornet@gmail.com>"]
+edition = "2018"
+
+[dependencies]
diff --git a/crates/src/lib.rs b/crates/src/lib.rs
new file mode 100644
index 0000000..5cf1d97
--- /dev/null
+++ b/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
+ }
+}
diff --git a/crates/src/main.rs b/crates/src/main.rs
new file mode 100644
index 0000000..80668f2
--- /dev/null
+++ b/crates/src/main.rs
@@ -0,0 +1,8 @@
+use art::PrimaryColor;
+use art::mix;
+
+fn main() {
+ let red = PrimaryColor::Red,
+ let yellow = PrimaryColor::Yellow;
+ mix(red, yellow);
+}