From fca68dfe8b49914d13f29706522cb0d3ad80a390 Mon Sep 17 00:00:00 2001 From: 53hornet <53hornet@gmail.com> Date: Fri, 22 Mar 2019 21:47:54 -0400 Subject: Added crates module (?) --- crates/Cargo.toml | 7 +++++++ crates/src/lib.rs | 33 +++++++++++++++++++++++++++++++++ crates/src/main.rs | 8 ++++++++ 3 files changed, 48 insertions(+) create mode 100644 crates/Cargo.toml create mode 100644 crates/src/lib.rs create mode 100644 crates/src/main.rs (limited to 'crates') 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); +} -- cgit v1.2.3 From 0dac5e02a0da650e20a6385c27a385d05823f80c Mon Sep 17 00:00:00 2001 From: 53hornet <53hornet@gmail.com> Date: Fri, 22 Mar 2019 21:48:40 -0400 Subject: Re-added Cargo.lock. --- crates/Cargo.lock | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 crates/Cargo.lock (limited to 'crates') diff --git a/crates/Cargo.lock b/crates/Cargo.lock new file mode 100644 index 0000000..3e95fa1 --- /dev/null +++ b/crates/Cargo.lock @@ -0,0 +1,4 @@ +[[package]] +name = "crates" +version = "0.1.0" + -- cgit v1.2.3