@@ -26,7 +26,7 @@ fn main() {
26
26
}
27
27
```
28
28
29
- 2 . 🌟 Hide the methods of the original type
29
+ 2 . 🌟 Hide the methods of the original type.
30
30
``` rust,editable
31
31
/* Make it workd */
32
32
struct Meters(u32);
@@ -41,7 +41,7 @@ fn main() {
41
41
}
42
42
```
43
43
44
- 3 . 🌟🌟 The ` newtype ` idiom gives compile time guarantees that the right type of value is suplied to a program.
44
+ 3 . 🌟🌟 The ` newtype ` idiom gives compile time guarantees that the right type of value is supplied to a program.
45
45
``` rust,editable
46
46
/* Make it work */
47
47
struct Years(i64);
@@ -61,7 +61,7 @@ impl Days {
61
61
}
62
62
}
63
63
64
- // an age verification function that checks age in years, must be given a value of type Years.
64
+ // An age verification function that checks age in years, must be given a value of type Years.
65
65
fn old_enough(age: &Years) -> bool {
66
66
age.0 >= 18
67
67
}
@@ -98,12 +98,12 @@ fn main() {
98
98
assert_eq!(format!("{}",d), "There are still 30 meters left");
99
99
}
100
100
101
- /* implement calculate_distance */
101
+ /* Implement calculate_distance */
102
102
fn calculate_distance
103
103
```
104
104
105
105
## Type alias
106
- The most importance of type alias is to improve the readability of our codes .
106
+ Type alias is important to improve the readability of our code .
107
107
108
108
``` rust
109
109
type Thunk = Box <dyn Fn () + Send + 'static >;
@@ -150,7 +150,7 @@ fn main() {
150
150
}
151
151
```
152
152
153
- 6 . 🌟🌟 There are a few preserved alias in Rust, one of which can be used in ` impl ` blocks.
153
+ 6 . 🌟🌟 There are a few preserved aliases in Rust, one of which can be used in ` impl ` blocks.
154
154
``` rust,editable
155
155
enum VeryVerboseEnumOfThingsToDoWithNumbers {
156
156
Add,
@@ -193,7 +193,7 @@ fn main() {
193
193
}
194
194
```
195
195
196
- 9 . 🌟🌟 Trait is also a unsized type
196
+ 9 . 🌟🌟 Trait is also an unsized type
197
197
``` rust,editable
198
198
/* Make it work in two ways */
199
199
use std::fmt::Display;
0 commit comments