Add modules example

This commit is contained in:
Timothy Warren 2019-01-30 15:20:20 -05:00
parent 96207be067
commit 7be0416c2f
9 changed files with 147 additions and 24 deletions

View File

@ -14,6 +14,7 @@
<cargoProject FILE="$PROJECT_DIR$/structs/Cargo.toml" />
<cargoProject FILE="$PROJECT_DIR$/rectangles/Cargo.toml" />
<cargoProject FILE="$PROJECT_DIR$/enums/Cargo.toml" />
<cargoProject FILE="$PROJECT_DIR$/modules/Cargo.toml" />
</component>
<component name="ComposerJsonPluginSettings">
<unboundedVersionInspectionSettings>

View File

@ -55,6 +55,10 @@
<sourceFolder url="file://$MODULE_DIR$/enums/examples" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/enums/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/enums/benches" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/modules/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/modules/examples" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/modules/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/modules/benches" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/branches/target" />
<excludeFolder url="file://$MODULE_DIR$/ctof/target" />
<excludeFolder url="file://$MODULE_DIR$/enums/target" />
@ -62,6 +66,7 @@
<excludeFolder url="file://$MODULE_DIR$/functions/target" />
<excludeFolder url="file://$MODULE_DIR$/guessing_game/target" />
<excludeFolder url="file://$MODULE_DIR$/loops/target" />
<excludeFolder url="file://$MODULE_DIR$/modules/target" />
<excludeFolder url="file://$MODULE_DIR$/rectangles/target" />
<excludeFolder url="file://$MODULE_DIR$/references/target" />
<excludeFolder url="file://$MODULE_DIR$/scope/target" />

View File

@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c8f42924-1cd2-4b1c-bcff-602a3368bb16" name="Default Changelist" comment="" />
<list default="true" id="c8f42924-1cd2-4b1c-bcff-602a3368bb16" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/rust.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/rust.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -11,16 +15,23 @@
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/enums/src/main.rs">
<entry file="file://$PROJECT_DIR$/guessing_game/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="440">
<caret line="30" column="7" selection-start-line="30" selection-start-column="7" selection-end-line="30" selection-end-column="7" />
<state relative-caret-position="32">
<caret line="2" column="5" selection-start-line="2" selection-start-column="5" selection-end-line="2" selection-end-column="5" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Rust File" />
</list>
</option>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>ftoc</find>
@ -30,7 +41,7 @@
</replaceStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/enums" />
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/guessing_game" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
@ -48,6 +59,11 @@
<option value="$PROJECT_DIR$/rectangles/src/main.rs" />
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/enums/src/main.rs" />
<option value="$PROJECT_DIR$/modules/src/sound.rs" />
<option value="$PROJECT_DIR$/modules/src/performance_group.rs" />
<option value="$PROJECT_DIR$/modules/src/main.rs" />
<option value="$PROJECT_DIR$/modules/src/sound/instrument.rs" />
<option value="$PROJECT_DIR$/guessing_game/.gitignore" />
</list>
</option>
</component>
@ -67,11 +83,26 @@
<ConfirmationsSetting value="1" id="Add" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<navigator currentView="Scope" currentSubView="Scope 'Project Files'; set:Project Files; class com.intellij.psi.search.scope.ProjectFilesScope" proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="Scope">
<subPane subId="Scope 'Project Files'; set:Project Files; class com.intellij.psi.search.scope.ProjectFilesScope">
<expand>
<path>
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
<item name="rust" type="2674bda8:ScopeViewTreeModel$GroupNode" />
</path>
<path>
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
<item name="rust" type="2674bda8:ScopeViewTreeModel$GroupNode" />
<item name="guessing_game" type="9f88c78c:ScopeViewTreeModel$FileNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
@ -80,6 +111,17 @@
<item name="rust" type="b2602c69:ProjectViewProjectNode" />
<item name="rust" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="rust" type="b2602c69:ProjectViewProjectNode" />
<item name="rust" type="462c0819:PsiDirectoryNode" />
<item name="modules" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="rust" type="b2602c69:ProjectViewProjectNode" />
<item name="rust" type="462c0819:PsiDirectoryNode" />
<item name="modules" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
@ -88,7 +130,7 @@
</component>
<component name="PropertiesComponent">
<property name="JavaScriptWeakerCompletionTypeGuess" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1548878099464" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1548879558121" />
<property name="javascript.nodejs.core.library.configured.version" value="7.1.0" />
<property name="js.eslint.eslintPackage" value="$USER_HOME$/.yarn-config/global/node_modules/.bin/eslint" />
<property name="js.eslint.nodeInterpreter" value="project" />
@ -116,7 +158,7 @@
</list>
</option>
</component>
<component name="RunManager" selected="Cargo Command.Run enums">
<component name="RunManager" selected="Cargo Command.Run modules">
<configuration name="&lt;template&gt;" type="TestNG" default="true" selected="false">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" value="-ea" />
@ -145,6 +187,16 @@
<envs />
<method v="2" />
</configuration>
<configuration name="Run modules" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
<option name="channel" value="DEFAULT" />
<option name="command" value="run --package modules --bin modules" />
<option name="allFeatures" value="false" />
<option name="nocapture" value="false" />
<option name="backtrace" value="SHORT" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/modules" />
<envs />
<method v="2" />
</configuration>
<configuration name="Run rectangles" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
<option name="channel" value="DEFAULT" />
<option name="command" value="run --package rectangles --bin rectangles" />
@ -155,16 +207,6 @@
<envs />
<method v="2" />
</configuration>
<configuration name="Run references" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
<option name="channel" value="DEFAULT" />
<option name="command" value="run --package references --bin references" />
<option name="allFeatures" value="false" />
<option name="nocapture" value="false" />
<option name="backtrace" value="SHORT" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/references" />
<envs />
<method v="2" />
</configuration>
<configuration name="Run slices" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
<option name="channel" value="DEFAULT" />
<option name="command" value="run --package slices --bin slices" />
@ -194,11 +236,11 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="Cargo Command.Run modules" />
<item itemvalue="Cargo Command.Run enums" />
<item itemvalue="Cargo Command.Run rectangles" />
<item itemvalue="Cargo Command.Run structs" />
<item itemvalue="Cargo Command.Run slices" />
<item itemvalue="Cargo Command.Run references" />
</list>
</recent_temporary>
</component>
@ -206,7 +248,7 @@
<frame x="1920" y="-438" width="1080" height="1897" extended-state="0" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.4970809" visible="true" weight="0.2540132" />
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.4970809" visible="true" weight="0.2540132" />
<window_info id="Structure" order="1" sideWeight="0.5029191" side_tool="true" visible="true" weight="0.2540132" />
<window_info id="Image Layers" order="2" />
<window_info id="Designer" order="3" />
@ -215,7 +257,7 @@
<window_info id="Cargo" order="6" sideWeight="0.49791494" weight="0.3286119" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32979318" />
<window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.32979318" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@ -344,10 +386,60 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.idea/workspace.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="368">
<caret line="23" column="40" selection-start-line="23" selection-start-column="40" selection-end-line="23" selection-end-column="40" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/enums/src/main.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="440">
<caret line="30" column="7" selection-start-line="30" selection-start-column="7" selection-end-line="30" selection-end-column="7" />
<state relative-caret-position="672">
<caret line="42" column="16" lean-forward="true" selection-start-line="42" selection-start-column="16" selection-end-line="42" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/modules/src/sound.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="16">
<caret line="1" lean-forward="true" selection-start-line="1" selection-end-line="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/modules/src/sound/instrument.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="48">
<caret line="3" lean-forward="true" selection-start-line="3" selection-end-line="3" />
<folding>
<element signature="e#18#19#0" expanded="true" />
<element signature="e#60#61#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/modules/src/performance_group.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="96">
<caret line="6" column="1" selection-start-line="6" selection-start-column="1" selection-end-line="6" selection-end-column="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/modules/src/main.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="96">
<caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" />
<folding>
<element signature="e#366#367#0" expanded="true" />
<element signature="e#390#391#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/guessing_game/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="32">
<caret line="2" column="5" selection-start-line="2" selection-start-column="5" selection-end-line="2" selection-end-column="5" />
</state>
</provider>
</entry>

View File

@ -1,2 +1,3 @@
/target
**/*.rs.bk
.idea

7
modules/Cargo.toml Normal file
View File

@ -0,0 +1,7 @@
[package]
name = "modules"
version = "0.1.0"
authors = ["Timothy Warren <twarren@nabancard.com>"]
edition = "2018"
[dependencies]

6
modules/src/main.rs Normal file
View File

@ -0,0 +1,6 @@
mod sound;
mod performance_group;
fn main() {
performance_group::clarinet_trio();
}

View File

@ -0,0 +1,7 @@
use crate::sound::instrument;
pub fn clarinet_trio() {
instrument::clarinet();
instrument::clarinet();
instrument::clarinet();
}

1
modules/src/sound.rs Normal file
View File

@ -0,0 +1 @@
pub mod instrument;

View File

@ -0,0 +1,3 @@
pub fn clarinet() {
println!("A clarinet is playing.");
}