Add workspace example (add)

This commit is contained in:
Timothy Warren 2019-02-04 13:27:47 -05:00
parent b10c01f40c
commit ca6840cec2
8 changed files with 189 additions and 11 deletions

View File

@ -23,6 +23,7 @@
<cargoProject FILE="$PROJECT_DIR$/minigrep/Cargo.toml" />
<cargoProject FILE="$PROJECT_DIR$/closures/Cargo.toml" />
<cargoProject FILE="$PROJECT_DIR$/minigrep_v2/Cargo.toml" />
<cargoProject FILE="$PROJECT_DIR$/add/Cargo.toml" />
</component>
<component name="ComposerJsonPluginSettings">
<unboundedVersionInspectionSettings>

View File

@ -90,6 +90,16 @@
<sourceFolder url="file://$MODULE_DIR$/minigrep_v2/examples" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/minigrep_v2/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/minigrep_v2/benches" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/add/adder/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/add/adder/examples" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/add/adder/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/add/adder/benches" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/add/add-one/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/add/add-one/examples" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/add/add-one/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/add/add-one/benches" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/add/add-one/target" />
<excludeFolder url="file://$MODULE_DIR$/add/adder/target" />
<excludeFolder url="file://$MODULE_DIR$/adder/target" />
<excludeFolder url="file://$MODULE_DIR$/branches/target" />
<excludeFolder url="file://$MODULE_DIR$/closures/target" />

View File

@ -27,16 +27,67 @@
<entry file="file://$PROJECT_DIR$/minigrep_v2/src/main.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272">
<caret line="17" lean-forward="true" selection-start-line="17" selection-end-line="17" />
<caret line="17" selection-start-line="17" selection-end-line="17" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/minigrep_v2/src/lib.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="624">
<caret line="39" selection-start-line="39" selection-end-line="39" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/add/Cargo.toml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="96">
<caret line="6" selection-start-line="6" selection-end-line="6" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/minigrep_v2/src/lib.rs">
<entry file="file://$PROJECT_DIR$/add/add-one/src/lib.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="960">
<caret line="60" column="40" selection-start-line="60" selection-start-column="40" selection-end-line="60" selection-end-column="40" />
<state relative-caret-position="208">
<caret line="13" column="5" lean-forward="true" selection-start-line="13" selection-start-column="5" selection-end-line="13" selection-end-column="5" />
<folding>
<element signature="e#30#31#0" expanded="true" />
<element signature="e#40#41#0" expanded="true" />
<element signature="e#87#88#0" expanded="true" />
<element signature="e#123#124#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/add/adder/Cargo.toml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144">
<caret line="9" selection-start-line="9" selection-end-line="9" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/add/adder/src/main.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="64">
<caret line="4" column="77" selection-start-line="4" selection-start-column="77" selection-end-line="4" selection-end-column="77" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/add/add-one/Cargo.toml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="7" selection-start-line="7" selection-end-line="7" />
</state>
</provider>
</entry>
@ -103,6 +154,11 @@
<option value="$PROJECT_DIR$/closures/src/lib.rs" />
<option value="$PROJECT_DIR$/minigrep_v2/src/main.rs" />
<option value="$PROJECT_DIR$/minigrep_v2/src/lib.rs" />
<option value="$PROJECT_DIR$/add/Cargo.toml" />
<option value="$PROJECT_DIR$/add/adder/src/main.rs" />
<option value="$PROJECT_DIR$/add/add-one/Cargo.toml" />
<option value="$PROJECT_DIR$/add/adder/Cargo.toml" />
<option value="$PROJECT_DIR$/add/add-one/src/lib.rs" />
</list>
</option>
</component>
@ -136,7 +192,33 @@
<path>
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
<item name="rust" type="2674bda8:ScopeViewTreeModel$GroupNode" />
<item name="minigrep" type="9f88c78c:ScopeViewTreeModel$FileNode" />
<item name="add" type="9f88c78c:ScopeViewTreeModel$FileNode" />
</path>
<path>
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
<item name="rust" type="2674bda8:ScopeViewTreeModel$GroupNode" />
<item name="add" type="9f88c78c:ScopeViewTreeModel$FileNode" />
<item name="add-one" type="9f88c78c:ScopeViewTreeModel$FileNode" />
</path>
<path>
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
<item name="rust" type="2674bda8:ScopeViewTreeModel$GroupNode" />
<item name="add" type="9f88c78c:ScopeViewTreeModel$FileNode" />
<item name="add-one" type="9f88c78c:ScopeViewTreeModel$FileNode" />
<item name="src" type="9f88c78c:ScopeViewTreeModel$FileNode" />
</path>
<path>
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
<item name="rust" type="2674bda8:ScopeViewTreeModel$GroupNode" />
<item name="add" type="9f88c78c:ScopeViewTreeModel$FileNode" />
<item name="adder" type="9f88c78c:ScopeViewTreeModel$FileNode" />
</path>
<path>
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
<item name="rust" type="2674bda8:ScopeViewTreeModel$GroupNode" />
<item name="add" type="9f88c78c:ScopeViewTreeModel$FileNode" />
<item name="adder" type="9f88c78c:ScopeViewTreeModel$FileNode" />
<item name="src" type="9f88c78c:ScopeViewTreeModel$FileNode" />
</path>
<path>
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
@ -180,7 +262,7 @@
</component>
<component name="PropertiesComponent">
<property name="JavaScriptWeakerCompletionTypeGuess" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1549056665919" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1549304605543" />
<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" />
@ -327,7 +409,7 @@
<frame x="1920" y="-438" width="1080" height="1897" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.4968701" visible="true" weight="0.2540132" />
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.4968701" visible="true" weight="0.2540132" />
<window_info id="Structure" order="1" sideWeight="0.5031299" side_tool="true" visible="true" weight="0.2540132" />
<window_info id="Image Layers" order="2" />
<window_info id="Designer" order="3" />
@ -344,7 +426,7 @@
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="8" />
<window_info anchor="bottom" id="Inspection Results" order="9" weight="0.32979318" />
<window_info active="true" anchor="bottom" id="Terminal" order="10" visible="true" weight="0.28563443" />
<window_info anchor="bottom" id="Terminal" order="10" visible="true" weight="0.28563443" />
<window_info anchor="bottom" id="Event Log" order="11" side_tool="true" />
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
@ -675,14 +757,55 @@
<entry file="file://$PROJECT_DIR$/minigrep_v2/src/main.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272">
<caret line="17" lean-forward="true" selection-start-line="17" selection-end-line="17" />
<caret line="17" selection-start-line="17" selection-end-line="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/minigrep_v2/src/lib.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="960">
<caret line="60" column="40" selection-start-line="60" selection-start-column="40" selection-end-line="60" selection-end-column="40" />
<state relative-caret-position="624">
<caret line="39" selection-start-line="39" selection-end-line="39" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/add/Cargo.toml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="96">
<caret line="6" selection-start-line="6" selection-end-line="6" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/add/adder/src/main.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="64">
<caret line="4" column="77" selection-start-line="4" selection-start-column="77" selection-end-line="4" selection-end-column="77" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/add/add-one/Cargo.toml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="7" selection-start-line="7" selection-end-line="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/add/adder/Cargo.toml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144">
<caret line="9" selection-start-line="9" selection-end-line="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/add/add-one/src/lib.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="208">
<caret line="13" column="5" lean-forward="true" selection-start-line="13" selection-start-column="5" selection-end-line="13" selection-end-column="5" />
<folding>
<element signature="e#30#31#0" expanded="true" />
<element signature="e#40#41#0" expanded="true" />
<element signature="e#87#88#0" expanded="true" />
<element signature="e#123#124#0" expanded="true" />
</folding>
</state>
</provider>
</entry>

6
add/Cargo.toml Normal file
View File

@ -0,0 +1,6 @@
[workspace]
members = [
"adder",
"add-one",
]

8
add/add-one/Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "add-one"
version = "0.1.0"
authors = ["Timothy Warren <twarren@nabancard.com>"]
edition = "2018"
[dependencies]
rand = "0.3.14"

15
add/add-one/src/lib.rs Normal file
View File

@ -0,0 +1,15 @@
use rand;
pub fn add_one(x: i32) -> i32 {
x + 1
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
assert_eq!(3, add_one(2));
}
}

9
add/adder/Cargo.toml Normal file
View File

@ -0,0 +1,9 @@
[package]
name = "adder"
version = "0.1.0"
authors = ["Timothy Warren <twarren@nabancard.com>"]
edition = "2018"
[dependencies]
add-one = { path = "../add-one" }
rand = "0.3.14"

6
add/adder/src/main.rs Normal file
View File

@ -0,0 +1,6 @@
use add_one;
fn main() {
let num = 10;
println!("Hello, world! {} plus one is {}!", num, add_one::add_one(num));
}