Skip to content

Commit 0062e4b

Browse files
fixed more typos
1 parent c683ce3 commit 0062e4b

6 files changed

+29
-28
lines changed

lessons/en/chapter_1.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
out for this keyword.
112112
- title: Basic Types
113113
code: >-
114-
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&code=fn+main%28%29+%7B%0A++++let+a+%3D+13u8%3B%0A++++let+b+%3D+7u32%3B%0A++++let+c+%3D+a+as+u32+%2B+b%3B%0A++++println%21%28%22%7B%7D%22%2C+c%29%3B%0A%0A++++let+t+%3D+true%3B%0A++++println%21%28%22%7B%7D%22%2C+t+as+u8%29%3B%0A%0A++++%0A++++let+d%3A+u32+%3D+12%3B%0A++++%2F%2F+let+e%3A+u32+%3D+-12%3B++%2F%2F+unsinged+nubers+include+only+positive+numbers%0A++++let+e%3A+i32+%3D+12%3B%0A++++let+f%3A+i32+%3D+-12%3B%0A++++println%21%28%22%7B%7D+%7B%7D+%7B%7D+%7B%7D%22%2C%0A++++++++++++++++d%2C+-%28d+as+i32%29%2C+e%2C+f%29%3B%0A%7D%0A%0A
114+
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&code=fn+main%28%29+%7B%0A++++let+a+%3D+13u8%3B%0A++++let+b+%3D+7u32%3B%0A++++let+c+%3D+a+as+u32+%2B+b%3B%0A++++println%21%28%22%7B%7D%22%2C+c%29%3B%0A%0A++++let+t+%3D+true%3B%0A++++println%21%28%22%7B%7D%22%2C+t+as+u8%29%3B%0A%0A++++let+d%3A+u32+%3D+12%3B%0A++++%2F%2F+let+e%3A+u32+%3D+-12%3B++%2F%2F+unsinged+nubers+include+only+positive+numbers%0A++++let+e%3A+i32+%3D+12%3B%0A++++let+f%3A+i32+%3D+-12%3B%0A++++println%21%28%22%7B%7D+%7B%7D+%7B%7D+%7B%7D%22%2C+d%2C+-%28d+as+i32%29%2C+e%2C+f%29%3B%0A%7D%0A
115115
content_markdown: >
116116
Basic data types:
117117
- bool
@@ -238,7 +238,7 @@
238238
| println!("{:#?}", x); | ✅ | ✅ |
239239
- title: Arrays
240240
code: >-
241-
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&code=fn+main%28%29+%7B%0A++++let+nums%3A+%5Bi32%3B+5%5D+%3D+%5B1%2C+2%2C+3%2C+4%2C+5%5D%3B%0A%0A++++println%21%28%22%7B%7D%22%2C+nums%5B1%5D%29%3B%0A%0A++++println%21%28%22%7B%3A%3F%7D%22%2C+nums%29%3B+++++%2F%2F+%3A%3F+for+displaying+collections%0A++++println%21%28%22%7B%3A%23%3F%7D%22%2C+nums%29%3B++++%2F%2F+%3A%23%3F+displaying+a+collection+in+debug+mode%0A++++%0A++++for+el+in+nums+%7B%0A++++++++print%21%28%22%7B%7D+%22%2C+el%29%3B%0A++++%7D%0A++++println%21%28%29%3B%0A++++%0A++++for+i+in+0..%3D%28nums.len%28%29+-+1%29+%7B%0A++++++++print%21%28%22%7B%7D+%22%2C+nums%5Bi%5D%29%3B%0A++++%7D%0A++++println%21%28%29%3B%0A++++%0A++++for+i+in+0..nums.len%28%29+%7B%0A++++++++print%21%28%22%7B%7D+%22%2C+nums%5Bi%5D%29%3B%0A++++%7D%0A++++println%21%28%22%22%29%3B%0A%7D%0A
241+
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&code=fn+main%28%29+%7B%0A++++let+nums%3A+%5Bi32%3B+5%5D+%3D+%5B1%2C+2%2C+3%2C+4%2C+5%5D%3B%0A%0A++++println%21%28%22%7B%7D%22%2C+nums%5B1%5D%29%3B%0A%0A++++println%21%28%22%7B%3A%3F%7D%22%2C+nums%29%3B+%2F%2F+%3A%3F+for+displaying+collections%0A++++println%21%28%22%7B%3A%23%3F%7D%22%2C+nums%29%3B+%2F%2F+%3A%23%3F+displaying+a+collection+in+debug+mode%0A%0A++++for+el+in+nums+%7B%0A++++++++print%21%28%22%7B%7D+%22%2C+el%29%3B%0A++++%7D%0A++++println%21%28%29%3B%0A%0A++++for+i+in+0..%3D%28nums.len%28%29+-+1%29+%7B%0A++++++++print%21%28%22%7B%7D+%22%2C+nums%5Bi%5D%29%3B%0A++++%7D%0A++++println%21%28%29%3B%0A%0A++++for+i+in+0..nums.len%28%29+%7B%0A++++++++print%21%28%22%7B%7D+%22%2C+nums%5Bi%5D%29%3B%0A++++%7D%0A++++println%21%28%22%22%29%3B%0A%7D%0A
242242
content_markdown: >
243243
An *array* is a **fixed length collection** of data elements all of the same
244244
type.

lessons/en/chapter_4.yaml

+9-7
Original file line numberDiff line numberDiff line change
@@ -193,24 +193,26 @@
193193
Otherwise, `if let Ok(..) = ..` will be chosen
194194
to handle the **success** case.
195195
196-
`if let` can be used only for `Result` and `Option` data tyes.
196+
`if let` can be used only for `Result` and `Option` data types.
197197
code: >-
198198
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=fn+div%28x%3A+f64%2C+y%3A+f64%29+-%3E+Result%3Cf64%2C+String%3E+%7B%0A++++if+y+%3D%3D+0.0+%7B%0A++++++++return+Err%28String%3A%3Afrom%28%22Invalid+operation%3A+division+by+zero.%22%29%29%3B%0A++++%7D%0A++++return+Ok%28x+%2F+y%29%3B%0A%7D%0A%0A%0Afn+main%28%29+%7B%0A++++if+let+Ok%28res%29+%3D+div%2810.0%2C+1.0%29+%7B%0A++++++++println%21%28%22%7B%7D%22%2C+res%29%3B++++++++%2F%2F+will+be+displayed%0A++++%7D%0A++++%0A++++if+let+Err%28err%29+%3D+div%2810.0%2C+1.0%29+%7B%0A++++++++println%21%28%22%7B%7D%22%2C+err%29%3B++++++++%2F%2F+will+NOT+be+displayed%0A++++%7D%0A++++%0A%0A++++if+let+Ok%28res%29+%3D+div%2810.0%2C+0.0%29+%7B%0A++++++++println%21%28%22%7B%7D%22%2C+res%29%3B++++++++%2F%2F+will+be+displayed%0A++++%7D%0A++++if+let+Err%28err%29+%3D+div%2810.0%2C+0.0%29+%7B%0A++++++++println%21%28%22%7B%7D%22%2C+err%29%3B++++++++%2F%2F+will+NOT+be+displayed%0A++++%7D%0A%7D%0A
199199
- title: Extracting a Result
200200
content_markdown: >
201201
Another brilliant way to extract a `Result<T, E> { Ok(T), Err(E), }`
202202
is to use the functions `.ok()` and `.err()`, representing the specific variant.
203203
204-
These functions will return an `Option`:
205-
- `Some` if the Result function had something to return, for results like `Result<i32, i32>`.
206-
- `None` if the Result function returned either a `Err(())` or an `Ok(())`, for results like `Result<(), ()>`, `Result<i32, ()>` or `Result<(), i32>`
204+
Let's assume we are working with a function whose return type is `Result`, just like in the example.
205+
Using `.ok()` and `.err()` on it will return an `Option`:
206+
- `Some` if the original function had something to return, for results like `Result<i32, i32>`.
207+
- `None` if the original function returned either a `Err(())` or an `Ok(())`, for results like `Result<(), ()>`, `Result<i32, ()>` or `Result<(), i32>`
208+
207209
code: >-
208210
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=fn+div1%28x%3A+f64%2C+y%3A+f64%29+-%3E+Result%3Cf64%2C+String%3E+%7B%0A++++if+y+%3D%3D+0.0+%7B%0A++++++++return+Err%28String%3A%3Afrom%28%22Invalid+operation%3A+division+by+zero.%22%29%29%3B%0A++++%7D%0A++++return+Ok%28x+%2F+y%29%3B%0A%7D%0A%0A%0Afn+div2%28x%3A+f64%2C+y%3A+f64%29+-%3E+Result%3Cf64%2C+%28%29%3E+%7B%0A++++if+y+%3D%3D+0.0+%7B%0A++++++++%2F%2F+notice+that+the+error+returns+%60None%60%0A++++++++%2F%2F+therefore+will+be+pattern-matched+using+%60%28%29%60%0A++++++++return+Err%28%28%29%29%3B%0A++++%7D%0A++++return+Ok%28x+%2F+y%29%3B%0A%7D%0A%0Afn+main%28%29+%7B%0A++++let+good1+%3D+div1%2810.0%2C+1.0%29%3B%0A++++let+bad1+%3D+div1%2810.0%2C+0.0%29%3B%0A++++%0A++++%2F%2F+Using+.ok%28%29+will+extract+the+Ok+variant%0A++++%2F%2F+.ok%28%29+returns+an+Option%3A+Some%0A++++if+let+Some%28value%29+%3D+good1.ok%28%29+%7B%0A++++++++println%21%28%22Result+%28Ok%29%3A+%7B%7D%22%2C+value%29%3B%0A++++%7D+else+%7B%0A++++++++println%21%28%22Result+%28Err%29%22%29%3B%0A++++%7D%0A%0A++++%2F%2F+Using+.err%28%29+to+extract+the+Err+variant%0A++++%2F%2F+.err%28%29+returns+an+Option%3A+Some%0A++++if+let+Some%28err%29+%3D+bad1.err%28%29+%7B%0A++++++++println%21%28%22Error%3A+%7B%7D%22%2C+err%29%3B%0A++++%7D+else+%7B%0A++++++++println%21%28%22No+error+%28Ok%29%22%29%3B%0A++++%7D%0A++++%0A++++%0A++++let+good2+%3D+div2%2810.0%2C+1.0%29%3B%0A++++let+bad2+%3D+div2%2810.0%2C+0.0%29%3B%0A++++%0A++++%2F%2F+Using+.ok%28%29+will+extract+the+Ok+variant%0A++++%2F%2F+.ok%28%29+returns+an+Option%3A+Some%0A++++if+let+Some%28value%29+%3D+good2.ok%28%29+%7B%0A++++++++println%21%28%22Result+%28Ok%29%3A+%7B%7D%22%2C+value%29%3B%0A++++%7D+else+%7B%0A++++++++println%21%28%22Result+%28Err%29%22%29%3B%0A++++%7D%0A%0A++++%2F%2F+Using+.err%28%29+to+extract+the+Err+variant%0A++++%2F%2F+.err%28%29+returns+an+Option%3A+None%0A++++if+let+Some%28%28%29%29+%3D+bad2.err%28%29+%7B%0A++++++++println%21%28%22Error+occured%22%29%3B%0A++++%7D+else+%7B%0A++++++++println%21%28%22No+error+%28Ok%29%22%29%3B%0A++++%7D%0A%7D%0A
209211
- title: About panic!
210212
content_markdown: >
211213
In Rust, `panic!` is a macro used to stop the execution of the program
212-
without a recoverable error. When a panic occurs, the program immediately
213-
stop, unwinding the stack and cleaning up resources along the way.
214+
without a recoverable error. When panic occurs, the program immediately
215+
stops, unwinding the stack and cleaning up resources along the way.
214216
215217
Moreover, the code instructions written after `panic!` will no longer be executed.
216218
@@ -261,7 +263,7 @@
261263
iterators were designed with a very powerful function, `.map()`.
262264
263265
`.map()` and `.iter()` are methods provided by iterators and are commonly
264-
used in working with collection (vectors and String, for instance).
266+
used in working with collections (vectors and String, for instance).
265267
266268
The function `.iter()` iterates over a reference to each element of a collection,
267269
generating a sequence of elements.

lessons/en/chapter_7.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
`Self`:
5656
- refers to **return type** of the method
5757
- has the same data type as the `struct` that is implemented in a `impl` block
58-
- can be used for static method using the operator `::` (static method do not depend on a instance of a struct and a static method does not contain `self` as parameter)
58+
- can be used for static methods using the operator `::` (they do not depend on a instance of a struct or contain `self` as a parameter)
5959
- title: Defining a macro
6060
code: >-
6161
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&code=struct+Coordinates+%7B%0A++++x%3A+i32%2C%0A++++y%3A+i32%2C%0A%7D%0A%0Aimpl+Coordinates+%7B%0A++++%2F%2F+original+copy+constructor%2C+a+static+method%0A++++fn+new%28xval%3A+i32%2C+yval%3A+i32%29+-%3E+Self+%7B%0A++++++++Coordinates+%7B+x%3A+xval%2C+y%3A+yval+%7D%0A++++%7D%0A%7D%0A%0Aimpl+Coordinates+%7B%0A++++fn+disp%28%26self%29+%7B%0A++++++++println%21%28%22Point+located+at%3A+%7B%7D+on+OX%2C+%7B%7D+on+OY%22%2C+self.x%2C+self.y%29%3B%0A++++%7D%0A%7D%0A%0A%2F%2F+the+coord%21+macro%0Amacro_rules%21+coord+%7B%0A++++%28%24x%3Aexpr%2C+%24y%3Aexpr%29+%3D%3E+%7B%0A++++++++Coordinates%3A%3Anew%28%24x%2C+%24y%29%0A++++%7D%3B%0A%7D%0A%0Afn+main%28%29+%7B%0A++++%2F%2F+Use+the+coord%21+macro+to+create+a+new+Coordinates+instance%0A++++let+p1%3A+Coordinates+%3D+coord%21%281%2C+2%29%3B%0A%0A++++%2F%2F+Alternatively%2C+you+can+use+the+coord%21+macro+with+square+brackets%0A++++let+p2+%3D+coord%21%5B2%2C+2%5D%3B%0A++++%0A++++let+p3+%3D+Coordinates+%7B%0A++++++++x%3A+10i32%2C%0A++++++++y%3A+11+as+i32%2C%0A++++%7D%3B%0A++++%0A++++let+p4+%3D+Coordinates%3A%3Anew%28-10%2C+11%29%3B%0A%0A++++p1.disp%28%29%3B%0A++++p2.disp%28%29%3B%0A++++p3.disp%28%29%3B%0A++++p4.disp%28%29%3B%0A%7D%0A

lessons/en/chapter_8.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
code: >-
3131
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&code=fn+main%28%29+%7B%0A++++let+a%3A+i32+%3D+12i32%3B%0A++++let+b%3A+%26i32+%3D+%26a%3B+++%2F%2F+pointer+to+i32%0A++++let+c%3A+%26%26i32+%3D+%26b%3B++%2F%2F+pointer+to+pointer+to+i32%0A++++let+d%3A+%26%26%26i32+%3D+%26c%3B%09%2F%2F+pointer+to+pointer+to+pointer+to+i32%0A++++%0A++++println%21%28%22%7B%7D+%7B%7D+%7B%7D+%7B%7D%22%2C+a%2C+b%2C+c%2C+d%29%3B%0A++++println%21%28%22%7B%7D+%7B%7D+%7B%7D+%7B%7D%22%2C+a%2C+*b%2C+**c%2C+***d%29%3B%0A%7D%0A
3232
content_markdown: >
33-
A pointer is a variable.
33+
A pointer is a variable that stores a memory address.
3434
3535
Each variable:
3636
- has a name

lessons/en/chapter_9.yaml

+4-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
writing code, which is `std` (the standard Rust library).
1414
1515
16-
Therefore, there are two type of crates in Rust:
16+
Therefore, there are two types of crates in Rust:
1717
- `binary crates` : contain a `main.rs` file
1818
- `library crates` : contain a `lib.rs` file
1919
@@ -35,8 +35,7 @@
3535
3636
In Rust there is not a 1 to 1 mapping of files to the module tree hierarchy. We must build the module tree explicitly by hand in our code.
3737
38-
39-
More information about how to split you code in different files / moduels
38+
More information about how to split you code into different files / modules
4039
can be found [here](https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/crates-and-modules.html).
4140
- title: Writing a Program
4241
content_markdown: |
@@ -57,7 +56,7 @@
5756
Cool!
5857
5958
A `binary crate` will depend on the `main.rs`.
60-
Btw, do not try to create a `lib.rs` here.
59+
By the way, do not try to create a `lib.rs` here.
6160
Our friend `cargo` will be confused.
6261
6362
- title: Writing a Library
@@ -234,7 +233,7 @@
234233
- title: Internal Module Referencing
235234
content_markdown: >
236235
Rust has several keywords you can use in your `use` path to quickly get
237-
ahold of the module you want:
236+
a hold of the module you want:
238237
239238
* `crate` - the root module of your crate
240239

lessons/ro/chapter_1.yaml

+12-12
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
Odată ce vă veți familiariza cu Rust, puteți să vă declarați un **Rustaceu**. Așa
1515
se numesc toți oamenii care folosesc, contribuie sau sunt interesați de Rust.
1616
17-
- title: What is Rust?
17+
- title: Ce este Rust?
1818
content_markdown: >
1919
Rust este un limbaj de programare al sistemelor care este cunoscut pentru accentul pe care îl pune
20-
siguranță, performanță și concurență.
20+
pe siguranță, performanță și concurență.
2121
22-
Rust este conceput pentru a oferi un control la nivel scăzut asupra resurselor sistemului
22+
Rust este conceput pentru a oferi control la un nivel aproape de hardware asupra resurselor sistemului
2323
fără a sacrifica abstracţiile de nivel înalt.
2424
2525
Ce are Rust diferit de alte limbaje de programare.
2626
- proprietate și împrumut
2727
- durata de viață
28-
- potrivire de model
28+
- potrivire de model (pattern matching)
2929
- concurență fără curse de date (rivalitate de date)
30-
- trasaturi
31-
- nu nul sau colectarea gunoiului
30+
- trăsături (trait-uri)
31+
- absența valorii `null` sau a colectării gunoiului (garbage collection)
3232
- macro-uri
33-
- marfa
33+
- pachete numite "cutii" (crates)
3434
- comunitate și ecosistem
3535
- UTF-8 și text Unicode
3636
- title: Rust Playground
@@ -44,12 +44,12 @@
4444
E o modalitate bună de a vă juca cu Rust și a arăta altora
4545
creativitatea și provocările dumneavoastră!
4646
47-
- title: What is println! ?
47+
- title: Ce este println! ?
4848
code: >-
4949
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&code=fn+main%28%29+%7B%0A++++println%21%28%29%3B%0A++++print%21%28%22Este+o+linie+deasupra.+%22%29%3B%0A++++print%21%28%22Ce+tare%2C+nu%3F%22%29%3B%0A++++println%21%28%29%3B+++++%2F%2F+linie+nou%C4%83+la+finalul+consolei%0A%7D%0A
5050
content_markdown: >
5151
Spre deosebire de alte limbaje de programare, unde există o funcție pentru
52-
afişarea în `stdout` (consola), Rust folosește `macro-urile` **println!** și **print!**.
52+
afişarea la `stdout` (consolă), Rust folosește `macro-urile` **println!** și **print!**.
5353
Vom vorbi despre `macro-uri` mai târziu.
5454
5555
> `println!` va afișa un nou caracter de linie nouă `\n` la sfârșitul șirului
@@ -63,7 +63,7 @@
6363
$ ./main
6464
```
6565
66-
Pe sistemele Windows?
66+
Pe sistemele Windows:
6767
```
6868
> rustc main.rs
6969
> .\main.exe
@@ -175,7 +175,7 @@
175175
176176
Tipurile numerice pot fi specificate explicit prin adăugarea tipului la finalul numărului (ex: `13u32`, `2u8`).
177177
178-
> nu se poate aplica operatorul unar `-` pe `u8`, `u17`, `u64`, `u128` si `usize`
178+
> nu se poate aplica operatorul unar `-` pe `u8`, `u17`, `u64`, `u128` și `usize`
179179
180180
- title: Conversia tipurilor de bază
181181
code: >-
@@ -206,7 +206,7 @@
206206
207207
Numele constantelor sunt mereu scrise în format `SCREAMING_SNAKE_CASE` (ex: MY\_FIRST\_CONSTANT).
208208
209-
- title: Colecți
209+
- title: Colecții
210210
code: >-
211211
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&code=use+std%3A%3Acollections%3A%3AHashMap%3B%0Ause+std%3A%3Acollections%3A%3AHashSet%3B%0A%0Afn+main%28%29+%7B%0A%0A++++%2F%2F+array%0A++++let+array%3A+%5Bi32%3B+3%5D+%3D+%5B1%2C+2%2C+3%5D%3B%0A++++println%21%28%22%7B%3A%3F%7D%22%2C+array%29%3B%0A++++%0A++++%2F%2F+vector%0A++++let+vector%3A+Vec%3Ci32%3E+%3D+vec%21%5B1%2C+2%2C+3%5D%3B%0A++++println%21%28%22%7B%3A%3F%7D%22%2C+vector%29%3B%0A%0A++++%2F%2F+slice+%28from+other+collection%29%0A++++let+slice+%3D+%26array%5B1..3%5D%3B%0A++++println%21%28%22%7B%3A%3F%7D%22%2C+slice%29%3B%0A++++%0A++++%2F%2F+string%0A++++let+string%3A+String+%3D+String%3A%3Afrom%28%22Hello%2C+Rust%21%22%29%3B%0A++++println%21%28%22%7B%3A%3F%7D%22%2C+string%29%3B%0A++++%0A++++%2F%2F+tuple%0A++++let+tuple%3A+%28i32%2C+f64%2C+u8%29+%3D+%2842%2C+3.14%2C+5%29%3B%0A++++println%21%28%22%7B%3A%3F%7D%22%2C+tuple%29%3B%0A%0A++++%2F%2F+map%0A++++let+mut+map+%3D+HashMap%3A%3Anew%28%29%3B%0A++++map.insert%28%22one%22%2C+1%29%3B%0A++++map.insert%28%22two%22%2C+2%29%3B%0A++++println%21%28%22%7B%3A%3F%7D%22%2C+map%29%3B%0A++++%0A++++%2F%2F+set%0A++++let+mut+set+%3D+HashSet%3A%3Anew%28%29%3B%0A++++set.insert%281%29%3B%0A++++set.insert%282%29%3B%0A++++println%21%28%22%7B%3A%3F%7D%22%2C+set%29%3B%0A%7D%0A
212212
content_markdown: >

0 commit comments

Comments
 (0)