-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac564e9
commit bf2ca54
Showing
41 changed files
with
55 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,55 @@ | ||
|
||
enum Result{ | ||
Success(String), | ||
Error(i32,String), | ||
} | ||
// enum Result{ | ||
// Success(String), | ||
// Error(i32,String), | ||
// } | ||
// | ||
// fn print_result(result: Result){ | ||
// match result { | ||
// Result::Success(str) => { | ||
// println!("the error message is :{}", str); | ||
// }, | ||
// Result::Error(code, message) => { | ||
// println!("Error {} :{}", code, message); | ||
// }, | ||
// } | ||
// | ||
// } | ||
// fn main() { | ||
// println!("enum practice"); | ||
// | ||
// let success_result = Result::Success(String::from("Operation completed")); | ||
// let error_result = Result::Error(404,String::from("Resurse not found".to_string())); | ||
// print_result(success_result); | ||
// | ||
// print_result(error_result); | ||
// } | ||
|
||
fn print_result(result: Result){ | ||
match result { | ||
Result::Success(str) => { | ||
println!("the error message is :{}", str); | ||
}, | ||
Result::Error(code, message) => { | ||
println!("Error {} :{}", code, message); | ||
}, | ||
} | ||
|
||
enum TrafificLight { | ||
red, | ||
green, | ||
yellow, | ||
} | ||
fn main() { | ||
println!("enum practice"); | ||
|
||
let success_result = Result::Success(String::from("Operation completed")); | ||
let error_result = Result::Error(404,String::from("Resurse not found".to_string())); | ||
print_result(success_result); | ||
|
||
print_result(error_result); | ||
fn color(light : TrafificLight) { | ||
match light { | ||
TrafificLight::red =>{ | ||
println!("Stop"); | ||
}, | ||
TrafificLight::green => { | ||
println!("Go"); | ||
}, | ||
TrafificLight::yellow => { | ||
println!("Wait"); | ||
}, | ||
} | ||
} | ||
|
||
fn main() { | ||
let color1 = TrafificLight::red; | ||
let color2 = TrafificLight::green; | ||
let color3 = TrafificLight::yellow; | ||
color(color1); | ||
color(color2); | ||
color(color3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"rustc_fingerprint":12367312050786819320,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.78.0 (9b00956e5 2024-04-29)\nbinary: rustc\ncommit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6\ncommit-date: 2024-04-29\nhost: x86_64-pc-windows-msvc\nrelease: 1.78.0\nLLVM version: 18.1.2\n","stderr":""},"12744816824612481171":{"success":true,"status":"","code":0,"stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\nC:\\Users\\misha\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\npacked\n___\ndebug_assertions\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"msvc\"\ntarget_family=\"windows\"\ntarget_feature=\"cmpxchg16b\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"lahfsahf\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_has_atomic\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"128\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"128\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"pc\"\nwindows\n","stderr":""}},"successes":{}} | ||
{"rustc_fingerprint":12367312050786819320,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\nC:\\Users\\misha\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\npacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"msvc\"\ntarget_family=\"windows\"\ntarget_feature=\"cmpxchg16b\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"pc\"\nwindows\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.78.0 (9b00956e5 2024-04-29)\nbinary: rustc\ncommit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6\ncommit-date: 2024-04-29\nhost: x86_64-pc-windows-msvc\nrelease: 1.78.0\nLLVM version: 18.1.2\n","stderr":""},"12744816824612481171":{"success":true,"status":"","code":0,"stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\nC:\\Users\\misha\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\npacked\n___\ndebug_assertions\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"msvc\"\ntarget_family=\"windows\"\ntarget_feature=\"cmpxchg16b\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"lahfsahf\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_has_atomic\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"128\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"128\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"pc\"\nwindows\n","stderr":""}},"successes":{}} |
4 changes: 4 additions & 0 deletions
4
practice/enums/target/debug/.fingerprint/enums-648477c465c3ae41/output-bin-enums
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{"$message_type":"diagnostic","message":"variant `red` should have an upper camel case name","code":{"code":"non_camel_case_types","explanation":null},"level":"warning","spans":[{"file_name":"src\\main.rs","byte_start":706,"byte_end":709,"line_start":30,"line_end":30,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" red,","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(non_camel_case_types)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"convert the identifier to upper camel case","code":null,"level":"help","spans":[{"file_name":"src\\main.rs","byte_start":706,"byte_end":709,"line_start":30,"line_end":30,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" red,","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":"Red","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;11mwarning\u001b[0m\u001b[0m\u001b[1m\u001b[38;5;15m: variant `red` should have an upper camel case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m--> \u001b[0m\u001b[0msrc\\main.rs:30:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14m30\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m red,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;11m^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;11mhelp: convert the identifier to upper camel case: `Red`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m= \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;15mnote\u001b[0m\u001b[0m: `#[warn(non_camel_case_types)]` on by default\u001b[0m\n\n"} | ||
{"$message_type":"diagnostic","message":"variant `green` should have an upper camel case name","code":{"code":"non_camel_case_types","explanation":null},"level":"warning","spans":[{"file_name":"src\\main.rs","byte_start":715,"byte_end":720,"line_start":31,"line_end":31,"column_start":5,"column_end":10,"is_primary":true,"text":[{"text":" green,","highlight_start":5,"highlight_end":10}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"convert the identifier to upper camel case","code":null,"level":"help","spans":[{"file_name":"src\\main.rs","byte_start":715,"byte_end":720,"line_start":31,"line_end":31,"column_start":5,"column_end":10,"is_primary":true,"text":[{"text":" green,","highlight_start":5,"highlight_end":10}],"label":null,"suggested_replacement":"Green","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;11mwarning\u001b[0m\u001b[0m\u001b[1m\u001b[38;5;15m: variant `green` should have an upper camel case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m--> \u001b[0m\u001b[0msrc\\main.rs:31:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14m31\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m green,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;11m^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;11mhelp: convert the identifier to upper camel case: `Green`\u001b[0m\n\n"} | ||
{"$message_type":"diagnostic","message":"variant `yellow` should have an upper camel case name","code":{"code":"non_camel_case_types","explanation":null},"level":"warning","spans":[{"file_name":"src\\main.rs","byte_start":726,"byte_end":732,"line_start":32,"line_end":32,"column_start":5,"column_end":11,"is_primary":true,"text":[{"text":" yellow,","highlight_start":5,"highlight_end":11}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"convert the identifier to upper camel case","code":null,"level":"help","spans":[{"file_name":"src\\main.rs","byte_start":726,"byte_end":732,"line_start":32,"line_end":32,"column_start":5,"column_end":11,"is_primary":true,"text":[{"text":" yellow,","highlight_start":5,"highlight_end":11}],"label":null,"suggested_replacement":"Yellow","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;11mwarning\u001b[0m\u001b[0m\u001b[1m\u001b[38;5;15m: variant `yellow` should have an upper camel case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m--> \u001b[0m\u001b[0msrc\\main.rs:32:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14m32\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m yellow,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;11m^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;11mhelp: convert the identifier to upper camel case (notice the capitalization): `Yellow`\u001b[0m\n\n"} | ||
{"$message_type":"diagnostic","message":"3 warnings emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;11mwarning\u001b[0m\u001b[0m\u001b[1m\u001b[38;5;15m: 3 warnings emitted\u001b[0m\n\n"} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-55.6 KB
...ums/target/debug/incremental/enums-7h2pso4mzurw/s-gwafb7eou6-yheto0-working/dep-graph.bin
Binary file not shown.
Binary file removed
BIN
-305 KB
...arget/debug/incremental/enums-7h2pso4mzurw/s-gwafb7eou6-yheto0-working/dep-graph.part.bin
Binary file not shown.
Binary file removed
BIN
-6.03 KB
...s/target/debug/incremental/enums-7h2pso4mzurw/s-gwafb7eou6-yheto0-working/query-cache.bin
Binary file not shown.
Binary file removed
BIN
-2.97 KB
...target/debug/incremental/enums-7h2pso4mzurw/s-gwafb7eou6-yheto0-working/ydl42fczsjcyh0f.o
Binary file not shown.
Binary file removed
BIN
-3.04 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/10r5berlequxoymo.o
Binary file not shown.
Binary file removed
BIN
-27.8 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/14jj8zomyyymxvvo.o
Binary file not shown.
Binary file removed
BIN
-14.7 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/17xtahg60eb844yt.o
Binary file not shown.
Binary file removed
BIN
-7.09 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/29lguta47sbg2i2f.o
Binary file not shown.
Binary file removed
BIN
-3.36 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/2fy0datmj59ddvr8.o
Binary file not shown.
Binary file removed
BIN
-19.9 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/2rn14asl9iuf37oo.o
Binary file not shown.
Binary file removed
BIN
-3.08 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/2znhy32j1m5r1e5u.o
Binary file not shown.
Binary file removed
BIN
-7.8 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/3bbyduz9nblw4fxc.o
Binary file not shown.
Binary file removed
BIN
-4.18 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/3ldmj77xelrv1nn4.o
Binary file not shown.
Binary file removed
BIN
-12.1 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/3opgzhadifzyra21.o
Binary file not shown.
Binary file removed
BIN
-5.59 KB
...mental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/3wpje1sva4g1xvg.o
Binary file not shown.
Binary file removed
BIN
-24.9 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/3y527u7m16odnhn3.o
Binary file not shown.
Binary file removed
BIN
-6.44 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/40c5vxif5noef8ew.o
Binary file not shown.
Binary file removed
BIN
-17.7 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/46oj1wocm9b58hqp.o
Binary file not shown.
Binary file removed
BIN
-42.1 KB
...ental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/4hpdhaf3lhrrmrmj.o
Binary file not shown.
Binary file removed
BIN
-308 KB
...ncremental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/dep-graph.bin
Binary file not shown.
Binary file removed
BIN
-72.4 KB
...remental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/query-cache.bin
Binary file not shown.
Binary file removed
BIN
-961 Bytes
...mental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/work-products.bin
Binary file not shown.
Binary file removed
BIN
-19.6 KB
...mental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so-bwa6csg9fl0tw2gre3edvcpk9/ydl42fczsjcyh0f.o
Binary file not shown.
Empty file removed
0
practice/enums/target/debug/incremental/enums-7h2pso4mzurw/s-gwafban3v9-fql4so.lock
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added
BIN
+63.3 KB
...ncremental/enums-7h2pso4mzurw/s-gwc58aruqd-ksim3c-5p0ghwmvroc072i8xauuq3ja2/dep-graph.bin
Binary file not shown.
Binary file added
BIN
+11.3 KB
...remental/enums-7h2pso4mzurw/s-gwc58aruqd-ksim3c-5p0ghwmvroc072i8xauuq3ja2/query-cache.bin
Binary file not shown.
File renamed without changes.
Binary file added
BIN
+4.88 KB
...mental/enums-7h2pso4mzurw/s-gwc58aruqd-ksim3c-5p0ghwmvroc072i8xauuq3ja2/ydl42fczsjcyh0f.o
Binary file not shown.
File renamed without changes.