mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 12:39:42 +00:00
Merge branch 'master' of https://github.com/sunface/rust-by-practice
This commit is contained in:
35
Readme.md
35
Readme.md
@ -1,25 +1,30 @@
|
|||||||
# Rust By Practice
|
# Rust By Practice
|
||||||
|
|
||||||
This book was designed for easily diving into Rust,and it's very easy to use: All you need to do is to make each exercise compile without ERRORS and Panics !
|
This book was designed for easily diving into Rust, and it's very easy to use: All you need to do is to make each exercise compile without ERRORS and Panics !
|
||||||
|
|
||||||
> 🎊 Updated on 2022-03-05: Add [Traits chapter](https://practice.rs/generics-traits/traits.html) and solutions
|
> 🎊 Updated on 2022-03-05: Add [Traits](https://practice.rs/generics-traits/traits.html)
|
||||||
|
|
||||||
|
## Read online
|
||||||
|
|
||||||
|
- [https://practice.rs](https://practice.rs)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Read, Edit and Run the exercise ONLINE
|
Part of our examples and exercises are borrowed from [Rust By Example](https://github.com/rust-lang/rust-by-example), thanks for your great works!
|
||||||
|
|
||||||
|
Although they are so awesome, we have our own secret weapons :)
|
||||||
|
|
||||||
- There are three parts in each chapter: examples, exercises and practices
|
- There are three parts in each chapter: examples, exercises and practices
|
||||||
|
|
||||||
- Covering nearly all aspects of Rust, such as **async/await, threads, sync primitives, optimizing and stand libraries** etc
|
|
||||||
|
|
||||||
- Solution for each exercise
|
|
||||||
|
|
||||||
- Difficulty from easy to super hard: easy 🌟 medium 🌟🌟 hard 🌟🌟🌟 super hard 🌟🌟🌟🌟
|
|
||||||
|
|
||||||
- Both [English](https://practice.rs) and [Chinsese](https://zh.practice.rs) are supported
|
|
||||||
|
|
||||||
|
- Besides examples, we have `a lot of exercises`, you can Read, Edit and Run them ONLINE
|
||||||
|
|
||||||
> Part of our examples and exercises are borrowed from [Rust By Example](https://github.com/rust-lang/rust-by-example), thanks for the great works you have been done!
|
- Covering nearly all aspects of Rust, such as async/await, threads, sync primitives, optimizing and standard libraries** etc.
|
||||||
|
|
||||||
|
- Every exercise has its own solutions
|
||||||
|
|
||||||
|
- The overall difficulties are a bit higher and from easy to super hard: easy 🌟 medium 🌟🌟 hard 🌟🌟🌟 super hard 🌟🌟🌟🌟
|
||||||
|
|
||||||
|
**What we want to do is fill in the gap between learning and getting started with real projects.**
|
||||||
|
|
||||||
## Some of our exercises
|
## Some of our exercises
|
||||||
|
|
||||||
@ -33,7 +38,7 @@ struct Point(i32, i32, i32);
|
|||||||
fn main() {
|
fn main() {
|
||||||
let v = Point(___, ___, ___);
|
let v = Point(___, ___, ___);
|
||||||
check_color(v);
|
check_color(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_color(p: Color) {
|
fn check_color(p: Color) {
|
||||||
let (x, _, _) = p;
|
let (x, _, _) = p;
|
||||||
@ -62,7 +67,7 @@ fn main() {
|
|||||||
|
|
||||||
// ONLY modify this line
|
// ONLY modify this line
|
||||||
println!("{}, {}, {:?}",f.name, f.data, f);
|
println!("{}, {}, {:?}",f.name, f.data, f);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
🌟🌟 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.
|
🌟🌟 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.
|
||||||
|
Reference in New Issue
Block a user