Update enums script
This commit is contained in:
parent
861134542a
commit
3ba5ffd976
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/branches" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/ctof" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/enums" vcs="Git" />
|
||||
|
@ -1,7 +1,9 @@
|
||||
<?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/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -10,24 +12,19 @@
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<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" />
|
||||
<state>
|
||||
<caret column="15" selection-start-column="15" selection-end-column="15" />
|
||||
<folding>
|
||||
<element signature="e#10#11#0" expanded="true" />
|
||||
<element signature="e#43#44#0" expanded="true" />
|
||||
<element signature="e#1331#1332#0" expanded="true" />
|
||||
<element signature="e#1364#1365#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">
|
||||
@ -56,6 +53,7 @@
|
||||
<option value="$PROJECT_DIR$/structs/src/main.rs" />
|
||||
<option value="$PROJECT_DIR$/rectangles/src/main.rs" />
|
||||
<option value="$PROJECT_DIR$/.gitignore" />
|
||||
<option value="$PROJECT_DIR$/enums/src/main.rs" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@ -96,7 +94,7 @@
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="JavaScriptWeakerCompletionTypeGuess" value="true" />
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1548875930471" />
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1548877775987" />
|
||||
<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" />
|
||||
@ -214,8 +212,8 @@
|
||||
<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 active="true" content_ui="combo" id="Project" order="0" sideWeight="0.49748462" visible="true" weight="0.2540132" />
|
||||
<window_info id="Structure" order="1" sideWeight="0.5025154" 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" />
|
||||
@ -231,7 +229,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 anchor="bottom" id="Terminal" order="10" visible="true" weight="0.32979318" />
|
||||
<window_info anchor="bottom" id="Terminal" order="10" 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" />
|
||||
@ -345,19 +343,23 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<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" />
|
||||
</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" />
|
||||
<state>
|
||||
<caret column="15" selection-start-column="15" selection-end-column="15" />
|
||||
<folding>
|
||||
<element signature="e#10#11#0" expanded="true" />
|
||||
<element signature="e#43#44#0" expanded="true" />
|
||||
<element signature="e#1331#1332#0" expanded="true" />
|
||||
<element signature="e#1364#1365#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
@ -1,3 +1,95 @@
|
||||
#[derive(Debug)]
|
||||
enum UsState {
|
||||
Alabama,
|
||||
Alaska,
|
||||
Arizona,
|
||||
Arkansaw,
|
||||
California,
|
||||
Colorado,
|
||||
Connecticut,
|
||||
Delaware,
|
||||
Florida,
|
||||
Georgia,
|
||||
Hawaii,
|
||||
Idaho,
|
||||
Illinois,
|
||||
Indianan,
|
||||
Iowa,
|
||||
Kansas,
|
||||
Kentucky,
|
||||
Louisiana,
|
||||
Maine,
|
||||
Maryland,
|
||||
Massachusetts,
|
||||
Michigan,
|
||||
Minnesota,
|
||||
Mississippi,
|
||||
Missouri,
|
||||
Montana,
|
||||
Nebraska,
|
||||
Nevada,
|
||||
New_Hampshire,
|
||||
New_Jersey,
|
||||
New_Mexico,
|
||||
New_York,
|
||||
North_Carolina,
|
||||
North_Dakota,
|
||||
Ohio,
|
||||
Oklahoma,
|
||||
Oregon,
|
||||
Pennsylvania,
|
||||
Rhode_Island,
|
||||
South_Carolina,
|
||||
South_Dakota,
|
||||
Tennessee,
|
||||
Texas,
|
||||
Utah,
|
||||
Vermont,
|
||||
Virginia,
|
||||
Washington,
|
||||
West_Virginia,
|
||||
Wisconsin,
|
||||
Wyoming,
|
||||
}
|
||||
|
||||
enum Coin {
|
||||
Penny,
|
||||
Nickel,
|
||||
Dime,
|
||||
Quarter(UsState),
|
||||
}
|
||||
|
||||
fn value_in_cents(coin: Coin) -> u32 {
|
||||
match coin {
|
||||
Coin::Penny => {
|
||||
println!("Lucky penny!");
|
||||
1
|
||||
},
|
||||
Coin::Nickel => 5,
|
||||
Coin::Dime => 10,
|
||||
Coin::Quarter(state) => {
|
||||
println!("State quarter from {:?}!", state);
|
||||
25
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
fn count_non_quarters(count: &mut u32, coin: Coin) {
|
||||
// If let is like matching on one condition of a match statement
|
||||
if let Coin::Quarter(state) = coin {
|
||||
println!("State quarter from {:?}!", state);
|
||||
} else {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
fn plus_one(x: Option<i32>) -> Option<i32> {
|
||||
match x {
|
||||
None => None, // Match is exhaustive, must define the 'None' case
|
||||
Some(i) => Some(i + 1),
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user