{"id":25096525,"url":"https://github.com/sid-146/getting-rusty","last_synced_at":"2025-04-02T01:40:23.110Z","repository":{"id":217932360,"uuid":"656317468","full_name":"sid-146/Getting-Rusty","owner":"sid-146","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-17T21:12:30.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T16:41:09.284Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://sid-146.github.io/Getting-Rusty/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sid-146.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-20T17:45:57.000Z","updated_at":"2024-04-17T21:04:49.000Z","dependencies_parsed_at":"2025-02-07T16:38:58.568Z","dependency_job_id":"986d3d7e-b8b3-4a29-8212-7c432501592b","html_url":"https://github.com/sid-146/Getting-Rusty","commit_stats":null,"previous_names":["sid-146/getting-rusty"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sid-146%2FGetting-Rusty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sid-146%2FGetting-Rusty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sid-146%2FGetting-Rusty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sid-146%2FGetting-Rusty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sid-146","download_url":"https://codeload.github.com/sid-146/Getting-Rusty/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246741187,"owners_count":20826063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-07T16:38:47.038Z","updated_at":"2025-04-02T01:40:23.083Z","avatar_url":"https://github.com/sid-146.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 style='text-align:center; color:#b7410e '\u003e\nGetting Rusty\n\u003c/h1\u003e\n\n\u003c!-- Add details about cargo --\u003e\n\nRust is a modern, systems programming language that combines high performance with a strong emphasis on memory safety and zero-cost abstractions. What sets Rust apart is its ownership system, which enables fine-grained control over memory allocation without the need for a garbage collector. Rust is particularly well-suited for building robust and efficient systems, including operating systems, game engines, and networked applications.\n\n\u003ch2 style='text-align:center;'\u003eVariables\u003c/h2\u003e\n\u003c!-- ## Variables --\u003e\n\n`let` is used to create a variable\n\nSyntax to declare Syntax\n\n`let variable_name = value_to_assign`\n\nIn rust the variables are immutable by default to make them mutable `mut` keyword is used before variable name\n\n`let mut variable_name = value_to_assign`\n\n\u003ch3 style='text-align:center;'\u003eSample Code for variable\u003c/h3\u003e\n\u003c!-- ### Sample Code for variable --\u003e\n\n```\n// default variable are immutable\nlet x = 5;\nprintln!(\"This is immutable x : {}\", x);\n\n#This is immutable x : 5\n\n// #[warn(unused_mut)] //! This will create a warning in case of variable in never updated\nlet mut y = 6;\nprintln!(\"This is mutable y : {}\", y);\n\n#This is mutable y : 6\n\ny = 7;\nprintln!(\"This is mutable y : {}\", y);\n\n#This is mutable x : 7\n\nconst MY_COUNT: u32 = 100_000;\nprintln!(\"This is const MY_COUNT : {}\", MY_COUNT);\n\n#This is const MY_COUNT x : 100000\n```\n\n### Shadowing\n\n- Shadowing allows you to create a variable with same name\n- But once the new value is assigned the old value is lost\n\n### Why shadowing\n\n- It preserves mutability\n- see i have not used mut keyword still i am able to change the value of shadow variable\n- also we can change the datatype of the variable\n\n### Sample Code\n\n```\nlet shadow = 10;\nprintln!(\"This is int shadow : {}\", shadow);\n\n#This is int shadow : 10\n\nlet shadow = shadow * 2;\nprintln!(\"This is shadow : {}\", shadow);\n\n#This is shadow : 20\n\nlet shadow = 10.9;\nprintln!(\"This is string shadow : {}\", shadow);\n\n#This is int shadow : 10.9\n\nlet shadow = \"This is string\";\nprintln!(\"This is string shadow : {}\", shadow);\n\n#This is int shadow : This is string\n```\n\n\u003cp style= \"text-align :center;\"\u003e\nMade by ❤ sid-146\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsid-146%2Fgetting-rusty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsid-146%2Fgetting-rusty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsid-146%2Fgetting-rusty/lists"}