{"id":13432787,"url":"https://github.com/sunface/rust-by-practice","last_synced_at":"2025-05-14T12:02:32.103Z","repository":{"id":37178190,"uuid":"129990396","full_name":"sunface/rust-by-practice","owner":"sunface","description":"Learning Rust By Practice,  narrowing the gap between beginner and skilled-dev through challenging examples, exercises and projects.","archived":false,"fork":false,"pushed_at":"2025-04-25T04:48:07.000Z","size":2962,"stargazers_count":12906,"open_issues_count":46,"forks_count":1055,"subscribers_count":69,"default_branch":"master","last_synced_at":"2025-05-07T11:41:45.463Z","etag":null,"topics":["example","examples","exercise","exercises","learning","practice","rust","study"],"latest_commit_sha":null,"homepage":"https://practice.course.rs","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunface.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,"zenodo":null}},"created_at":"2018-04-18T02:13:19.000Z","updated_at":"2025-05-07T09:08:47.000Z","dependencies_parsed_at":"2023-02-15T12:46:28.606Z","dependency_job_id":"79941b19-3558-4f7e-8672-681ed3a7bc1c","html_url":"https://github.com/sunface/rust-by-practice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunface%2Frust-by-practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunface%2Frust-by-practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunface%2Frust-by-practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunface%2Frust-by-practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunface","download_url":"https://codeload.github.com/sunface/rust-by-practice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254140738,"owners_count":22021218,"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":["example","examples","exercise","exercises","learning","practice","rust","study"],"created_at":"2024-07-31T02:01:16.565Z","updated_at":"2025-05-14T12:02:32.049Z","avatar_url":"https://github.com/sunface.png","language":"Rust","readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/sunface/rust-by-practice/blob/master/en/assets/header.jpg?raw=true\"\u003e\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cspan\u003eEnglish\u003c/span\u003e\n    \u003cspan\u003e | \u003c/span\u003e\n    \u003ca href=\"https://github.com/sunface/rust-by-practice/blob/master/zh-CN/src/why-exercise.md\"\u003e中文\u003c/a\u003e\n\u003c/p\u003e\n    \n\u003cp align=\"center\"\u003ePractice Rust with challenging examples, exercises and projects\u003c/p\u003e\n    \n\u003cdiv align=\"center\"\u003e\n\n[![Stars Count](https://img.shields.io/github/stars/sunface/rust-by-practice?style=flat)](https://github.com/sunface/rust-by-practice/stargazers) \n[![studyrut](https://img.shields.io/badge/RustCn-orange)](https://hirust.cn) \n[![LICENSE](https://img.shields.io/badge/license-CC_BY_4.0-green?style=flat)](https://github.com/sunface/rust-by-practice/blob/master/LICENSE)\n\u003c/div\u003e\n\nThis book was designed for easily diving into and getting skilled with Rust It's very easy to use. All you need to do is to make each exercise compile without ERRORS and Panics!\n\n\n## Reading online\n\n- [https://practice.rs](https://practice.rs)\n\n## Features\n\nPart of our examples and exercises are borrowed from [Rust By Example](https://github.com/rust-lang/rust-by-example), thanks for your great works!\n\nAlthough they are so awesome, we have our own secret weapons :)\n\n- There are three parts in each chapter: examples, exercises and practices\n\n- Besides examples, we have `a lot of exercises`, you can Read, Edit and Run them ONLINE\n\n- Covering nearly all aspects of Rust, such as async/await, threads, sync primitives, optimizing, standard libraries, tool chain, data structures and algorithms etc.\n\n- Every exercise has its own solutions\n\n- The overall difficulties are a bit higher and from easy to super hard: easy 🌟 medium 🌟🌟 hard 🌟🌟🌟 super hard 🌟🌟🌟🌟\n\n**What we want to do is fill in the gap between learning and getting started with real projects.**\n\n## 🏅 Contributors\n\nThanks to all of our [contributors](https://github.com/sunface/rust-by-practice/graphs/contributors)!\n\n\u003cbr /\u003e\n\n**🏆 Special thanks to our English editor:**\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd align=\"center\"\u003e\n            \u003ca href=\"https://github.com/Tanish-Eagle\"\u003e\n                \u003cimg src=\"https://avatars.githubusercontent.com/u/71984506?v=4?s=100\" width=\"160px\"   alt=\"\"/\u003e\n                \u003cbr /\u003e\n                \u003csub\u003e\u003cb\u003eTanish-Eagle\u003c/b\u003e\u003c/sub\u003e\n            \u003c/a\u003e\n        \u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cbr /\u003e\n\n## Running locally\n\nWe use [mdbook](https://rust-lang.github.io/mdBook/) building our exercises. You can run locally with below steps:\n\n- Clone the repo\n```shell\n$ git clone https://github.com/sunface/rust-by-practice\n```\n- Install mdbook using Cargo\n```shell\n$ cargo install mdbook\n```\n\n- For Book in English\n```shell\n$ cd rust-by-practice \u0026\u0026 mdbook serve en/\n```\n\n- For Book in Chinese\n```shell\n$ cd rust-by-practice \u0026\u0026 mdbook serve zh-CN/\n```\n\n## Some of our exercises\n\n🌟🌟🌟 Tuple struct looks similar to tuples, it has added meaning the struct name provides but has no named fields. It's useful when you want give the whole tuple a name, but don't care the fields's names.\n\n```rust\n\n// fix the error and fill the blanks\nstruct Color(i32, i32, i32);\nstruct Point(i32, i32, i32);\nfn main() {\n    let v = Point(___, ___, ___);\n    check_color(v);\n}\n\nfn check_color(p: Color) {\n    let (x, _, _) = p;\n    assert_eq!(x, 0);\n    assert_eq!(p.1, 127);\n    assert_eq!(___, 255);\n }\n```\n\n🌟🌟 Within the destructuring of a single variable, both by-move and by-reference pattern bindings can be used at the same time. Doing this will result in a partial move of the variable, which means that parts of the variable will be moved while other parts stay. In such a case, the parent variable cannot be used afterwards as a whole, however the parts that are only referenced (and not moved) can still be used.\n```rust\n\n// fix errors to make it work\n#[derive(Debug)]\nstruct File {\n    name: String,\n    data: String,\n}\nfn main() {\n    let f = File {\n        name: String::from(\"readme.md\"),\n        data: \"Rust By Practice\".to_string()\n    };\n\n    let _name = f.name;\n\n    // ONLY modify this line\n    println!(\"{}, {}, {:?}\",f.name, f.data, f);\n}\n```\n\n🌟🌟 A match guard is an additional if condition specified after the pattern in a match arm that must also match, along with the pattern matching, for that arm to be chosen.\n```rust,editable\n\n// fill in the blank to make the code work, `split` MUST be used\nfn main() {\n    let num = Some(4);\n    let split = 5;\n    match num {\n        Some(x) __ =\u003e assert!(x \u003c split),\n        Some(x) =\u003e assert!(x \u003e= split),\n        None =\u003e (),\n    }\n}\n```\n","funding_links":[],"categories":["Rust","HarmonyOS","语言资源库","Rust 程序设计","Summary","资源"],"sub_categories":["Windows Manager","books","网络服务_其他","书籍"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunface%2Frust-by-practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunface%2Frust-by-practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunface%2Frust-by-practice/lists"}