First commit
This commit is contained in:
commit
861134542a
44
.gitignore
vendored
Normal file
44
.gitignore
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# Created by https://www.gitignore.io/api/osx,rust
|
||||||
|
# Edit at https://www.gitignore.io/?templates=osx,rust
|
||||||
|
|
||||||
|
### OSX ###
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
### Rust ###
|
||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
/target/
|
||||||
|
|
||||||
|
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||||
|
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||||
|
Cargo.lock
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
||||||
|
|
||||||
|
# End of https://www.gitignore.io/api/osx,rust
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Standard" />
|
||||||
|
</state>
|
||||||
|
</component>
|
4
.idea/encodings.xml
generated
Normal file
4
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||||
|
</project>
|
10
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
10
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="Eslint" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
|
||||||
|
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
|
||||||
|
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
6
.idea/jsLinters/eslint.xml
generated
Normal file
6
.idea/jsLinters/eslint.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="EslintConfiguration">
|
||||||
|
<custom-configuration-file used="true" path="/home/twarren/.eslintrc" />
|
||||||
|
</component>
|
||||||
|
</project>
|
43
.idea/misc.xml
generated
Normal file
43
.idea/misc.xml
generated
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CargoProjects">
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/variables/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/guessing_game/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/functions/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/branches/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/loops/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/ftoc/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/ctof/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/scope/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/references/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/slices/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/structs/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/rectangles/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/enums/Cargo.toml" />
|
||||||
|
</component>
|
||||||
|
<component name="ComposerJsonPluginSettings">
|
||||||
|
<unboundedVersionInspectionSettings>
|
||||||
|
<excludedPackages />
|
||||||
|
</unboundedVersionInspectionSettings>
|
||||||
|
<customRepositories />
|
||||||
|
</component>
|
||||||
|
<component name="ComposerSettings" phpInterpreterId="0eb028b2-5d56-4270-bfc6-cb7bb1d1d7b1">
|
||||||
|
<pharConfigPath>composer.json</pharConfigPath>
|
||||||
|
<pharPath>/usr/local/bin/composer</pharPath>
|
||||||
|
</component>
|
||||||
|
<component name="ESLintProjectComponent">
|
||||||
|
<option name="eslintRcFile" value="/home/twarren/.eslintrc" />
|
||||||
|
<option name="eslintExecutable" value="$USER_HOME$/.yarn-config/global/node_modules/.bin/eslint" />
|
||||||
|
<option name="nodeInterpreter" value="/usr/local/bin/node" />
|
||||||
|
<option name="pluginEnabled" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="JavaScriptSettings">
|
||||||
|
<option name="languageLevel" value="ES6" />
|
||||||
|
</component>
|
||||||
|
<component name="PhpProjectSharedConfiguration" php_language_level="7" />
|
||||||
|
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" interpreter_name="PHP cli" />
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||||
|
<component name="RustProjectSettings">
|
||||||
|
<option name="toolchainHomeDirectory" value="$USER_HOME$/.cargo/bin" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/rust.iml" filepath="$PROJECT_DIR$/.idea/rust.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
75
.idea/rust.iml
generated
Normal file
75
.idea/rust.iml
generated
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/variables/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/variables/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/variables/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/variables/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/guessing_game/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/guessing_game/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/guessing_game/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/guessing_game/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/functions/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/functions/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/functions/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/functions/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/branches/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/branches/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/branches/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/branches/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/loops/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/loops/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/loops/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/loops/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/ftoc/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/ftoc/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/ftoc/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/ftoc/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/ctof/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/ctof/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/ctof/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/ctof/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/scope/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/scope/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/scope/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/scope/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/references/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/references/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/references/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/references/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/slices/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/slices/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/slices/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/slices/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/structs/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/structs/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/structs/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/structs/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/rectangles/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/rectangles/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/rectangles/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/rectangles/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/enums/src" isTestSource="false" />
|
||||||
|
<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" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/branches/target" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/ctof/target" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/enums/target" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/ftoc/target" />
|
||||||
|
<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$/rectangles/target" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/references/target" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/scope/target" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/slices/target" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/structs/target" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/variables/target" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
18
.idea/vcs.xml
generated
Normal file
18
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/branches" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/ctof" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/enums" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/ftoc" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/functions" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/guessing_game" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/loops" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/rectangles" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/references" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/scope" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/slices" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/structs" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/variables" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
363
.idea/workspace.xml
generated
Normal file
363
.idea/workspace.xml
generated
Normal file
@ -0,0 +1,363 @@
|
|||||||
|
<?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="" />
|
||||||
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="FileEditorManager">
|
||||||
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/enums/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="48">
|
||||||
|
<caret line="3" selection-start-line="3" selection-end-line="3" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#10#11#0" expanded="true" />
|
||||||
|
<element signature="e#43#44#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="true">
|
||||||
|
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||||
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
</leaf>
|
||||||
|
</component>
|
||||||
|
<component name="FindInProjectRecents">
|
||||||
|
<findStrings>
|
||||||
|
<find>ftoc</find>
|
||||||
|
</findStrings>
|
||||||
|
<replaceStrings>
|
||||||
|
<replace>f_to_c</replace>
|
||||||
|
</replaceStrings>
|
||||||
|
</component>
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/enums" />
|
||||||
|
</component>
|
||||||
|
<component name="IdeDocumentHistory">
|
||||||
|
<option name="CHANGED_PATHS">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/variables/src/main.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/functions/src/main.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/branches/src/main.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/ctof/src/main.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/ftoc/src/main.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/loops/src/main.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/scope/src/main.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/references/src/main.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/slices/src/main.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/structs/src/main.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/rectangles/src/main.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/.gitignore" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="JsFlowSettings">
|
||||||
|
<service-enabled>false</service-enabled>
|
||||||
|
<exe-path />
|
||||||
|
<annotation-enable>false</annotation-enable>
|
||||||
|
<other-services-enabled>false</other-services-enabled>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectFrameBounds">
|
||||||
|
<option name="x" value="1920" />
|
||||||
|
<option name="y" value="-438" />
|
||||||
|
<option name="width" value="1080" />
|
||||||
|
<option name="height" value="1897" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||||
|
<ConfirmationsSetting value="1" id="Add" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectView">
|
||||||
|
<navigator proportions="" version="1">
|
||||||
|
<foldersAlwaysOnTop value="true" />
|
||||||
|
</navigator>
|
||||||
|
<panes>
|
||||||
|
<pane id="Scope" />
|
||||||
|
<pane id="PackagesPane" />
|
||||||
|
<pane id="ProjectPane">
|
||||||
|
<subPane>
|
||||||
|
<expand>
|
||||||
|
<path>
|
||||||
|
<item name="rust" type="b2602c69:ProjectViewProjectNode" />
|
||||||
|
<item name="rust" type="462c0819:PsiDirectoryNode" />
|
||||||
|
</path>
|
||||||
|
</expand>
|
||||||
|
<select />
|
||||||
|
</subPane>
|
||||||
|
</pane>
|
||||||
|
</panes>
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent">
|
||||||
|
<property name="JavaScriptWeakerCompletionTypeGuess" value="true" />
|
||||||
|
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1548875930471" />
|
||||||
|
<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" />
|
||||||
|
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||||
|
<property name="node.js.detected.package.eslint" value="true" />
|
||||||
|
<property name="node.js.path.for.package.eslint" value="project" />
|
||||||
|
<property name="node.js.path.for.package.standard" value="project" />
|
||||||
|
<property name="node.js.selected.package.eslint" value="/usr/local/lib/node_modules/eslint" />
|
||||||
|
<property name="node.js.selected.package.standard" value="" />
|
||||||
|
<property name="nodejs_interpreter_path.stuck_in_default_project" value="/usr/local/bin/node" />
|
||||||
|
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
||||||
|
<property name="org.rust.cargo.project.model.PROJECT_DISCOVERY" value="true" />
|
||||||
|
<property name="run.code.analysis.last.selected.profile" value="pProject Default" />
|
||||||
|
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.IDE.editor.colors.Language Defaults" />
|
||||||
|
</component>
|
||||||
|
<component name="RunDashboard">
|
||||||
|
<option name="ruleStates">
|
||||||
|
<list>
|
||||||
|
<RuleState>
|
||||||
|
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||||
|
</RuleState>
|
||||||
|
<RuleState>
|
||||||
|
<option name="name" value="StatusDashboardGroupingRule" />
|
||||||
|
</RuleState>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="RunManager" selected="Cargo Command.Run rectangles">
|
||||||
|
<configuration name="<template>" type="TestNG" default="true" selected="false">
|
||||||
|
<option name="MAIN_CLASS_NAME" />
|
||||||
|
<option name="VM_PARAMETERS" value="-ea" />
|
||||||
|
<option name="PARAMETERS" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="Applet">
|
||||||
|
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="Application" factoryName="Application">
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</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" />
|
||||||
|
<option name="allFeatures" value="false" />
|
||||||
|
<option name="nocapture" value="false" />
|
||||||
|
<option name="backtrace" value="SHORT" />
|
||||||
|
<option name="workingDirectory" value="file://$PROJECT_DIR$/rectangles" />
|
||||||
|
<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 scope" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||||
|
<option name="channel" value="DEFAULT" />
|
||||||
|
<option name="command" value="run --package scope --bin scope" />
|
||||||
|
<option name="allFeatures" value="false" />
|
||||||
|
<option name="nocapture" value="false" />
|
||||||
|
<option name="backtrace" value="SHORT" />
|
||||||
|
<option name="workingDirectory" value="file://$PROJECT_DIR$/scope" />
|
||||||
|
<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" />
|
||||||
|
<option name="allFeatures" value="false" />
|
||||||
|
<option name="nocapture" value="false" />
|
||||||
|
<option name="backtrace" value="SHORT" />
|
||||||
|
<option name="workingDirectory" value="file://$PROJECT_DIR$/slices" />
|
||||||
|
<envs />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration name="Run structs" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||||
|
<option name="channel" value="DEFAULT" />
|
||||||
|
<option name="command" value="run --package structs --bin structs" />
|
||||||
|
<option name="allFeatures" value="false" />
|
||||||
|
<option name="nocapture" value="false" />
|
||||||
|
<option name="backtrace" value="SHORT" />
|
||||||
|
<option name="workingDirectory" value="file://$PROJECT_DIR$/structs" />
|
||||||
|
<envs />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="JUnit" factoryName="JUnit">
|
||||||
|
<option name="TEST_OBJECT" value="class" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<recent_temporary>
|
||||||
|
<list>
|
||||||
|
<item itemvalue="Cargo Command.Run rectangles" />
|
||||||
|
<item itemvalue="Cargo Command.Run structs" />
|
||||||
|
<item itemvalue="Cargo Command.Run slices" />
|
||||||
|
<item itemvalue="Cargo Command.Run references" />
|
||||||
|
<item itemvalue="Cargo Command.Run scope" />
|
||||||
|
</list>
|
||||||
|
</recent_temporary>
|
||||||
|
</component>
|
||||||
|
<component name="ToolWindowManager">
|
||||||
|
<frame x="1920" y="-438" width="1080" height="1897" extended-state="0" />
|
||||||
|
<editor active="true" />
|
||||||
|
<layout>
|
||||||
|
<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" />
|
||||||
|
<window_info id="Capture Tool" order="4" />
|
||||||
|
<window_info id="Favorites" order="5" side_tool="true" />
|
||||||
|
<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 anchor="bottom" id="Run" order="2" 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" />
|
||||||
|
<window_info anchor="bottom" id="TODO" order="6" />
|
||||||
|
<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 anchor="bottom" id="Terminal" order="10" visible="true" weight="0.32979318" />
|
||||||
|
<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" />
|
||||||
|
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||||
|
<window_info anchor="right" id="Theme Preview" order="3" />
|
||||||
|
<window_info anchor="right" id="Capture Analysis" order="4" />
|
||||||
|
<window_info anchor="right" id="Palette	" order="5" />
|
||||||
|
</layout>
|
||||||
|
</component>
|
||||||
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
<option name="version" value="1" />
|
||||||
|
</component>
|
||||||
|
<component name="editorHistoryManager">
|
||||||
|
<entry file="file://$PROJECT_DIR$/variables/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="144">
|
||||||
|
<caret line="9" lean-forward="true" selection-start-line="9" selection-end-line="9" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/functions/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="128">
|
||||||
|
<caret line="8" column="41" selection-start-line="8" selection-start-column="41" selection-end-line="8" selection-end-column="41" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/branches/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="160">
|
||||||
|
<caret line="10" selection-start-line="10" selection-end-line="10" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/guessing_game/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="192">
|
||||||
|
<caret line="12" selection-start-line="12" selection-end-line="12" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/ctof/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="304">
|
||||||
|
<caret line="19" column="8" selection-start-line="19" selection-start-column="8" selection-end-line="19" selection-end-column="8" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#450#451#0" expanded="true" />
|
||||||
|
<element signature="e#475#476#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/ftoc/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="352">
|
||||||
|
<caret line="22" lean-forward="true" selection-start-line="22" selection-end-line="22" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#456#457#0" expanded="true" />
|
||||||
|
<element signature="e#488#489#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/loops/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="944">
|
||||||
|
<caret line="59" lean-forward="true" selection-start-line="59" selection-end-line="59" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/references/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="368">
|
||||||
|
<caret line="23" lean-forward="true" selection-start-line="23" selection-end-line="23" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#381#382#0" expanded="true" />
|
||||||
|
<element signature="e#399#400#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/scope/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="352">
|
||||||
|
<caret line="22" column="66" selection-start-line="22" selection-start-column="66" selection-end-line="22" selection-end-column="66" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/structs/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="624">
|
||||||
|
<caret line="39" lean-forward="true" selection-start-line="39" selection-end-line="39" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/slices/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="704">
|
||||||
|
<caret line="44" selection-start-line="44" selection-end-line="44" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/rectangles/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="704">
|
||||||
|
<caret line="44" lean-forward="true" selection-start-line="44" selection-end-line="44" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#133#134#0" expanded="true" />
|
||||||
|
<element signature="e#176#177#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/enums/src/main.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="48">
|
||||||
|
<caret line="3" selection-start-line="3" selection-end-line="3" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#10#11#0" expanded="true" />
|
||||||
|
<element signature="e#43#44#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||||
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
|
</entry>
|
||||||
|
</component>
|
||||||
|
</project>
|
2
branches/.gitignore
vendored
Normal file
2
branches/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
7
branches/Cargo.toml
Normal file
7
branches/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "branches"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
10
branches/src/main.rs
Normal file
10
branches/src/main.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fn main() {
|
||||||
|
let condition = true;
|
||||||
|
let number = if condition {
|
||||||
|
5
|
||||||
|
} else {
|
||||||
|
6
|
||||||
|
};
|
||||||
|
|
||||||
|
println!("The value of number is: {}", number);
|
||||||
|
}
|
2
ctof/.gitignore
vendored
Normal file
2
ctof/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
7
ctof/Cargo.toml
Normal file
7
ctof/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "ctof"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
22
ctof/src/main.rs
Normal file
22
ctof/src/main.rs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
use std::io;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println!("Celsius to Fahrenheit Converter");
|
||||||
|
println!("Enter temperature in Celsius");
|
||||||
|
|
||||||
|
let mut temp = String::new();
|
||||||
|
|
||||||
|
io::stdin().read_line(&mut temp)
|
||||||
|
.expect("Failed to read line");
|
||||||
|
|
||||||
|
let input_temp: f64 = temp.trim().parse()
|
||||||
|
.expect("Input must be a number");
|
||||||
|
|
||||||
|
let converted = c_to_f(input_temp);
|
||||||
|
|
||||||
|
println!("{}°C is {}°F", input_temp, converted);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn c_to_f(celsius: f64) -> f64 {
|
||||||
|
celsius * 1.8 + 32.0
|
||||||
|
}
|
2
enums/.gitignore
vendored
Normal file
2
enums/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
7
enums/Cargo.toml
Normal file
7
enums/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "enums"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
3
enums/src/main.rs
Normal file
3
enums/src/main.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
2
ftoc/.gitignore
vendored
Normal file
2
ftoc/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
7
ftoc/Cargo.toml
Normal file
7
ftoc/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "ftoc"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
22
ftoc/src/main.rs
Normal file
22
ftoc/src/main.rs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
use std::io;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println!("Fahrenheit to Celsius Converter");
|
||||||
|
println!("Enter temperature in Fahrenheit");
|
||||||
|
|
||||||
|
let mut temp = String::new();
|
||||||
|
|
||||||
|
io::stdin().read_line(&mut temp)
|
||||||
|
.expect("Failed to read line");
|
||||||
|
|
||||||
|
let input_temp: f64 = temp.trim().parse()
|
||||||
|
.expect("Input must be a number");
|
||||||
|
|
||||||
|
let converted = f_to_c(input_temp);
|
||||||
|
|
||||||
|
println!("{}°F is {}°C", input_temp, converted);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn f_to_c(fahrenheit: f64) -> f64 {
|
||||||
|
(fahrenheit - 32.0) / 1.8
|
||||||
|
}
|
2
functions/.gitignore
vendored
Normal file
2
functions/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
7
functions/Cargo.toml
Normal file
7
functions/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "functions"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
10
functions/src/main.rs
Normal file
10
functions/src/main.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
|
||||||
|
another_function(5, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn another_function(x: i32, y: i32) {
|
||||||
|
println!("The value of x is: {}", x);
|
||||||
|
println!("The value of y is: {}", y);
|
||||||
|
}
|
2
guessing_game/.gitignore
vendored
Normal file
2
guessing_game/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
8
guessing_game/Cargo.toml
Normal file
8
guessing_game/Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[package]
|
||||||
|
name = "guessing_game"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
rand = "0.3.14"
|
34
guessing_game/src/main.rs
Normal file
34
guessing_game/src/main.rs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
use std::io;
|
||||||
|
use std::cmp::Ordering;
|
||||||
|
use rand::Rng;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println!("Guess the number!");
|
||||||
|
|
||||||
|
let secret_number = rand::thread_rng().gen_range(1, 101);
|
||||||
|
|
||||||
|
loop {
|
||||||
|
println!("Please input your guess.");
|
||||||
|
|
||||||
|
let mut guess = String::new();
|
||||||
|
|
||||||
|
io::stdin().read_line(&mut guess)
|
||||||
|
.expect("Failed to read line");
|
||||||
|
|
||||||
|
let guess: u32 = match guess.trim().parse() {
|
||||||
|
Ok(num) => num,
|
||||||
|
Err(_) => continue,
|
||||||
|
};
|
||||||
|
|
||||||
|
println!("You guessed: {}", guess);
|
||||||
|
|
||||||
|
match guess.cmp(&secret_number) {
|
||||||
|
Ordering::Less => println!("Too small!"),
|
||||||
|
Ordering::Greater => println!("Too big!"),
|
||||||
|
Ordering::Equal => {
|
||||||
|
println!("You win!");
|
||||||
|
break;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2
loops/.gitignore
vendored
Normal file
2
loops/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
7
loops/Cargo.toml
Normal file
7
loops/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "loops"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
59
loops/src/main.rs
Normal file
59
loops/src/main.rs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
fn main() {
|
||||||
|
return_from_loop();
|
||||||
|
while_loop();
|
||||||
|
while_loop2();
|
||||||
|
for_loop();
|
||||||
|
for_range_loop();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn return_from_loop() {
|
||||||
|
let mut counter = 0;
|
||||||
|
|
||||||
|
let result = loop {
|
||||||
|
counter += 1;
|
||||||
|
|
||||||
|
if counter == 10 {
|
||||||
|
break counter * 2;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_eq!(result, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn while_loop() {
|
||||||
|
let mut number = 3;
|
||||||
|
|
||||||
|
while number != 0 {
|
||||||
|
println!("{}!", number);
|
||||||
|
|
||||||
|
number = number - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("LIFTOFF!!!");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn while_loop2() {
|
||||||
|
let a = [10, 20, 30, 40, 50];
|
||||||
|
let mut index = 0;
|
||||||
|
|
||||||
|
while index < 5 {
|
||||||
|
println!("The value is: {}", a[index]);
|
||||||
|
|
||||||
|
index = index + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn for_loop() {
|
||||||
|
let a = [10, 20, 30, 40, 50];
|
||||||
|
|
||||||
|
for element in a.iter() {
|
||||||
|
println!("The value is: {}", element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn for_range_loop() {
|
||||||
|
for number in (1..4).rev() {
|
||||||
|
println!("{}!", number);
|
||||||
|
}
|
||||||
|
println!("LIFTOFF!!!");
|
||||||
|
}
|
2
rectangles/.gitignore
vendored
Normal file
2
rectangles/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
7
rectangles/Cargo.toml
Normal file
7
rectangles/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "rectangles"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
44
rectangles/src/main.rs
Normal file
44
rectangles/src/main.rs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#[derive(Debug)]
|
||||||
|
struct Rectangle {
|
||||||
|
width: u32,
|
||||||
|
height: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
// You could also have an individual impl block
|
||||||
|
// for each method
|
||||||
|
impl Rectangle {
|
||||||
|
fn area(&self) -> u32 {
|
||||||
|
self.width * self.height
|
||||||
|
}
|
||||||
|
|
||||||
|
fn can_hold(&self, other: &Rectangle) -> bool {
|
||||||
|
self.width > other.width && self.height > other.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Rectangle {
|
||||||
|
// This is basically a static method
|
||||||
|
// But is called an associated function
|
||||||
|
fn square(size: u32) -> Rectangle {
|
||||||
|
Rectangle {
|
||||||
|
width: size,
|
||||||
|
height: size,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let rect1 = Rectangle { width: 30, height: 50 };
|
||||||
|
let rect2 = Rectangle { width: 10, height: 40 };
|
||||||
|
let rect3 = Rectangle { width: 60, height: 45 };
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"The area of the rectangle is {} square pixels.",
|
||||||
|
rect1.area()
|
||||||
|
);
|
||||||
|
|
||||||
|
println!("Can rect1 hold rect2? {}", rect1.can_hold(&rect2));
|
||||||
|
println!("Can rect1 hold rect3? {}", rect1.can_hold(&rect3));
|
||||||
|
|
||||||
|
println!("A square is a rectangle with equal sides: {:#?}", Rectangle::square(10));
|
||||||
|
}
|
2
references/.gitignore
vendored
Normal file
2
references/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
7
references/Cargo.toml
Normal file
7
references/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "references"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
23
references/src/main.rs
Normal file
23
references/src/main.rs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
fn main() {
|
||||||
|
let mut s1 = String::from("hello");
|
||||||
|
|
||||||
|
// Mutation by reference requires &mut on both
|
||||||
|
// the function declaration and the call site
|
||||||
|
change(&mut s1);
|
||||||
|
|
||||||
|
let len = calculate_length(&s1);
|
||||||
|
|
||||||
|
println!("The length of '{}' is {}.", s1, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn calculate_length(s: &String) -> usize { // s is a reference to a String
|
||||||
|
s.len()
|
||||||
|
} // Here, s goes out of scope. But because it does not have ownership of what
|
||||||
|
// it refers to, nothing happens.
|
||||||
|
|
||||||
|
// Change takes a mutable reference
|
||||||
|
// only one mutable reference can exist at a time
|
||||||
|
fn change(some_string: &mut String) {
|
||||||
|
some_string.push_str(", world");
|
||||||
|
}
|
2
scope/.gitignore
vendored
Normal file
2
scope/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
7
scope/Cargo.toml
Normal file
7
scope/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "scope"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
53
scope/src/main.rs
Normal file
53
scope/src/main.rs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
fn main() {
|
||||||
|
let s = String::from("hello"); // s comes into scope
|
||||||
|
|
||||||
|
takes_ownership(s); // s's value moves into the function...
|
||||||
|
// ... and so is no longer valid here
|
||||||
|
|
||||||
|
let x = 5; // x comes into scope
|
||||||
|
|
||||||
|
makes_copy(x); // x would move into the function,
|
||||||
|
// but i32 is Copy, so it’s okay to still
|
||||||
|
// use x afterward
|
||||||
|
|
||||||
|
let s1 = gives_ownership(); // gives_ownership moves its return
|
||||||
|
// value into s1
|
||||||
|
|
||||||
|
let s2 = String::from("hello"); // s2 comes into scope
|
||||||
|
|
||||||
|
let s3 = takes_and_gives_back(s2); // s2 is moved into
|
||||||
|
// takes_and_gives_back, which also
|
||||||
|
// moves its return value into s3
|
||||||
|
|
||||||
|
} // Here, s3 goes out of scope and is dropped. s2 goes out of scope but was
|
||||||
|
// moved, so nothing happens. s1 goes out of scope and is dropped.
|
||||||
|
// Here, x goes out of scope, then s. But because s's value was moved, nothing
|
||||||
|
// special happens.
|
||||||
|
|
||||||
|
fn takes_ownership(some_string: String) { // some_string comes into scope
|
||||||
|
println!("{}", some_string);
|
||||||
|
} // Here, some_string goes out of scope and `drop` is called. The backing
|
||||||
|
// memory is freed.
|
||||||
|
|
||||||
|
fn makes_copy(some_integer: i32) { // some_integer comes into scope
|
||||||
|
println!("{}", some_integer);
|
||||||
|
} // Here, some_integer goes out of scope. Nothing special happens.
|
||||||
|
|
||||||
|
fn gives_ownership() -> String { // gives_ownership will move its
|
||||||
|
// return value into the function
|
||||||
|
// that calls it
|
||||||
|
|
||||||
|
let some_string = String::from("hello"); // some_string comes into scope
|
||||||
|
|
||||||
|
some_string // some_string is returned and
|
||||||
|
// moves out to the calling
|
||||||
|
// function
|
||||||
|
}
|
||||||
|
|
||||||
|
// takes_and_gives_back will take a String and return one
|
||||||
|
fn takes_and_gives_back(a_string: String) -> String { // a_string comes into
|
||||||
|
// scope
|
||||||
|
|
||||||
|
a_string // a_string is returned and moves out to the calling function
|
||||||
|
}
|
||||||
|
|
2
slices/.gitignore
vendored
Normal file
2
slices/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
7
slices/Cargo.toml
Normal file
7
slices/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "slices"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
44
slices/src/main.rs
Normal file
44
slices/src/main.rs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// Rust range syntax variants
|
||||||
|
// let len = s.len();
|
||||||
|
// &s[0..5] == &s[0..=4]
|
||||||
|
// &s[6..11] == &s[0..=10]
|
||||||
|
// &s[0..2] == &s[..2]
|
||||||
|
// &s[3..len] == &s[3..]
|
||||||
|
// &s[0..len] == &s[..]
|
||||||
|
fn main() {
|
||||||
|
let my_string = String::from("hello world");
|
||||||
|
|
||||||
|
// first_word works on slices of `String`s
|
||||||
|
let word = first_word(&my_string[..]);
|
||||||
|
|
||||||
|
println!("the first word is: {}", word);
|
||||||
|
|
||||||
|
let my_string_literal = "hello world";
|
||||||
|
|
||||||
|
// first_word works on slices of string literals
|
||||||
|
let word = first_word(&my_string_literal[..]);
|
||||||
|
|
||||||
|
println!("the first word is: {}", word);
|
||||||
|
|
||||||
|
// Because string literals *are* string slices already,
|
||||||
|
// this works too, without the slice syntax!
|
||||||
|
let word = first_word(my_string_literal);
|
||||||
|
|
||||||
|
println!("the first word is: {}", word);
|
||||||
|
}
|
||||||
|
|
||||||
|
// &str accepts both String and str, String type and slices
|
||||||
|
fn first_word(s: &str) -> &str {
|
||||||
|
let bytes = s.as_bytes(); // String to array of bytes
|
||||||
|
|
||||||
|
// enumerate takes the value of iter and returns a tuple for each index
|
||||||
|
for (i, &item) in bytes.iter().enumerate() {
|
||||||
|
if item == b' ' {
|
||||||
|
return &s[0..i]; // Return the slice from 0 to i-1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&s[..] // Return a slice equal to the input string
|
||||||
|
}
|
||||||
|
|
||||||
|
|
2
structs/.gitignore
vendored
Normal file
2
structs/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
7
structs/Cargo.toml
Normal file
7
structs/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "structs"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
39
structs/src/main.rs
Normal file
39
structs/src/main.rs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
struct User {
|
||||||
|
username: String,
|
||||||
|
email: String,
|
||||||
|
sign_in_count: u64,
|
||||||
|
active: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tuple Structs
|
||||||
|
struct Color(i32, i32, i32);
|
||||||
|
struct Point(i32, i32, i32);
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut user1 = build_user(
|
||||||
|
String::from("someone@example.com"),
|
||||||
|
String::from("someusername123")
|
||||||
|
);
|
||||||
|
|
||||||
|
user1.email = String::from("anotheremail@example.com");
|
||||||
|
|
||||||
|
println!("Hello, {}, with email address: {}", user1.username, user1.email);
|
||||||
|
|
||||||
|
// Ooo... struct spread syntax...sort of
|
||||||
|
let user2 = User {
|
||||||
|
email: String::from("another@example.com"),
|
||||||
|
username: String::from("anotherusername567"),
|
||||||
|
..user1
|
||||||
|
};
|
||||||
|
|
||||||
|
println!("Hello, {}, with email address: {}", user2.username, user2.email);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn build_user(email: String, username: String) -> User {
|
||||||
|
User {
|
||||||
|
email,
|
||||||
|
username,
|
||||||
|
active: true,
|
||||||
|
sign_in_count: 1,
|
||||||
|
}
|
||||||
|
}
|
2
variables/.gitignore
vendored
Normal file
2
variables/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
7
variables/Cargo.toml
Normal file
7
variables/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "variables"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
7
variables/scope/Cargo.toml
Normal file
7
variables/scope/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "scope"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
3
variables/scope/src/main.rs
Normal file
3
variables/scope/src/main.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
9
variables/src/main.rs
Normal file
9
variables/src/main.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fn main() {
|
||||||
|
let x = 5;
|
||||||
|
|
||||||
|
let x = x + 1;
|
||||||
|
|
||||||
|
let x = x * 2;
|
||||||
|
|
||||||
|
println!("The value of x is: {}", x);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user