From 7be0416c2f45ffff7ecfba1f3ba6919fd2df3173 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 30 Jan 2019 15:20:20 -0500 Subject: [PATCH] Add modules example --- .idea/misc.xml | 1 + .idea/rust.iml | 5 ++ .idea/workspace.xml | 140 +++++++++++++++++++++++++------ guessing_game/.gitignore | 1 + modules/Cargo.toml | 7 ++ modules/src/main.rs | 6 ++ modules/src/performance_group.rs | 7 ++ modules/src/sound.rs | 1 + modules/src/sound/instrument.rs | 3 + 9 files changed, 147 insertions(+), 24 deletions(-) create mode 100644 modules/Cargo.toml create mode 100644 modules/src/main.rs create mode 100644 modules/src/performance_group.rs create mode 100644 modules/src/sound.rs create mode 100644 modules/src/sound/instrument.rs diff --git a/.idea/misc.xml b/.idea/misc.xml index 07de02a..b7bb25f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -14,6 +14,7 @@ + diff --git a/.idea/rust.iml b/.idea/rust.iml index 58d5604..88c150b 100644 --- a/.idea/rust.iml +++ b/.idea/rust.iml @@ -55,6 +55,10 @@ + + + + @@ -62,6 +66,7 @@ + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1de8081..d7cf9de 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,11 @@ - + + + + + @@ -67,11 +83,26 @@ - + - + + + + + + + + + + + + + + @@ -88,7 +130,7 @@ - + @@ -116,7 +158,7 @@ - + + + - - + - @@ -206,7 +248,7 @@ - + @@ -215,7 +257,7 @@ - + @@ -344,10 +386,60 @@ + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/guessing_game/.gitignore b/guessing_game/.gitignore index 53eaa21..2bb8d25 100644 --- a/guessing_game/.gitignore +++ b/guessing_game/.gitignore @@ -1,2 +1,3 @@ /target **/*.rs.bk +.idea diff --git a/modules/Cargo.toml b/modules/Cargo.toml new file mode 100644 index 0000000..0301914 --- /dev/null +++ b/modules/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "modules" +version = "0.1.0" +authors = ["Timothy Warren "] +edition = "2018" + +[dependencies] diff --git a/modules/src/main.rs b/modules/src/main.rs new file mode 100644 index 0000000..2be7df9 --- /dev/null +++ b/modules/src/main.rs @@ -0,0 +1,6 @@ +mod sound; +mod performance_group; + +fn main() { + performance_group::clarinet_trio(); +} diff --git a/modules/src/performance_group.rs b/modules/src/performance_group.rs new file mode 100644 index 0000000..52281a3 --- /dev/null +++ b/modules/src/performance_group.rs @@ -0,0 +1,7 @@ +use crate::sound::instrument; + +pub fn clarinet_trio() { + instrument::clarinet(); + instrument::clarinet(); + instrument::clarinet(); +} diff --git a/modules/src/sound.rs b/modules/src/sound.rs new file mode 100644 index 0000000..866ac56 --- /dev/null +++ b/modules/src/sound.rs @@ -0,0 +1 @@ +pub mod instrument; diff --git a/modules/src/sound/instrument.rs b/modules/src/sound/instrument.rs new file mode 100644 index 0000000..651789d --- /dev/null +++ b/modules/src/sound/instrument.rs @@ -0,0 +1,3 @@ +pub fn clarinet() { + println!("A clarinet is playing."); +}