Skip to content

Commit d49d36b

Browse files
authored
Merge pull request sunface#339 from Tanish-Eagle/edit
Edited the newtype
2 parents 743de95 + fc2446f commit d49d36b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

en/src/newtype-sized.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn main() {
2626
}
2727
```
2828

29-
2. 🌟 Hide the methods of the original type
29+
2. 🌟 Hide the methods of the original type.
3030
```rust,editable
3131
/* Make it workd */
3232
struct Meters(u32);
@@ -41,7 +41,7 @@ fn main() {
4141
}
4242
```
4343

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.
4545
```rust,editable
4646
/* Make it work */
4747
struct Years(i64);
@@ -61,7 +61,7 @@ impl Days {
6161
}
6262
}
6363
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.
6565
fn old_enough(age: &Years) -> bool {
6666
age.0 >= 18
6767
}
@@ -98,12 +98,12 @@ fn main() {
9898
assert_eq!(format!("{}",d), "There are still 30 meters left");
9999
}
100100
101-
/* implement calculate_distance */
101+
/* Implement calculate_distance */
102102
fn calculate_distance
103103
```
104104

105105
## 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.
107107

108108
```rust
109109
type Thunk = Box<dyn Fn() + Send + 'static>;
@@ -150,7 +150,7 @@ fn main() {
150150
}
151151
```
152152

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.
154154
```rust,editable
155155
enum VeryVerboseEnumOfThingsToDoWithNumbers {
156156
Add,
@@ -193,7 +193,7 @@ fn main() {
193193
}
194194
```
195195

196-
9. 🌟🌟 Trait is also a unsized type
196+
9. 🌟🌟 Trait is also an unsized type
197197
```rust,editable
198198
/* Make it work in two ways */
199199
use std::fmt::Display;

0 commit comments

Comments
 (0)