diff --git a/second-edition/nostarch/chapter08.md b/second-edition/nostarch/chapter08.md index 6c8946644..86a0ddd09 100644 --- a/second-edition/nostarch/chapter08.md +++ b/second-edition/nostarch/chapter08.md @@ -49,17 +49,17 @@ Note that we added a type annotation here. Because we aren’t inserting any values into this vector, Rust doesn’t know what kind of elements we intend to store. This is an important point. Vectors are implemented using generics; we’ll cover how to use generics with your own types in Chapter 10. For now, -know that the `Vec` type provided by the standard library can hold any type, -and when a specific `Vec` holds a specific type, the type is specified within -angle brackets. In Listing 8-1, we’ve told Rust that the `Vec` in `v` will hold -elements of the `i32` type. +know that the `Vec` type provided by the standard library can hold any type, +and when a specific vector holds a specific type, the type is specified within +angle brackets. In Listing 8-1, we’ve told Rust that the `Vec` in `v` will +hold elements of the `i32` type. In more realistic code, Rust can often infer the type of value we want to store once we insert values, so you rarely need to do this type annotation. It’s more -common to create a `Vec` that has initial values, and Rust provides the `vec!` -macro for convenience. The macro will create a new `Vec` that holds the values -we give it. Listing 8-2 creates a new `Vec` that holds the values `1`, -`2`, and `3`: +common to create a `Vec` that has initial values, and Rust provides the +`vec!` macro for convenience. The macro will create a new vector that holds the +values we give it. Listing 8-2 creates a new `Vec` that holds the values +`1`, `2`, and `3`: ```rust let v = vec![1, 2, 3]; @@ -389,7 +389,7 @@ string literal Because strings are used for so many things, we can use many different generic APIs for strings, providing us with a lot of options. Some of them can seem redundant, but they all have their place! In this case, `String::from` and -`.to_string` do the same thing, so which you choose is a matter of style. +`to_string` do the same thing, so which you choose is a matter of style. Remember that strings are UTF-8 encoded, so we can include any properly encoded data in them, as shown in Listing 8-12: @@ -761,12 +761,12 @@ a team’s name and the values are each team’s score. Given a team name, you c retrieve its score. We’ll go over the basic API of hash maps in this section, but many more goodies -are hiding in the functions defined on `HashMap` by the standard library. As -always, check the standard library documentation for more information. +are hiding in the functions defined on `HashMap` by the standard library. +As always, check the standard library documentation for more information. ### Creating a New Hash Map -We can create an empty `HashMap` with `new` and add elements with `insert`. In +We can create an empty hash map with `new` and add elements with `insert`. In Listing 8-18, we’re keeping track of the scores of two teams whose names are Blue and Yellow. The Blue team will start with 10 points, and the Yellow team starts with 50: diff --git a/second-edition/nostarch/odt/chapter08.docx b/second-edition/nostarch/odt/chapter08.docx index 682119840..9569c6a3d 100644 Binary files a/second-edition/nostarch/odt/chapter08.docx and b/second-edition/nostarch/odt/chapter08.docx differ diff --git a/second-edition/src/ch08-01-vectors.md b/second-edition/src/ch08-01-vectors.md index aafcfd2b0..c6d6fed7b 100644 --- a/second-edition/src/ch08-01-vectors.md +++ b/second-edition/src/ch08-01-vectors.md @@ -23,17 +23,17 @@ Note that we added a type annotation here. Because we aren’t inserting any values into this vector, Rust doesn’t know what kind of elements we intend to store. This is an important point. Vectors are implemented using generics; we’ll cover how to use generics with your own types in Chapter 10. For now, -know that the `Vec` type provided by the standard library can hold any type, -and when a specific `Vec` holds a specific type, the type is specified within -angle brackets. In Listing 8-1, we’ve told Rust that the `Vec` in `v` will hold -elements of the `i32` type. +know that the `Vec` type provided by the standard library can hold any type, +and when a specific vector holds a specific type, the type is specified within +angle brackets. In Listing 8-1, we’ve told Rust that the `Vec` in `v` will +hold elements of the `i32` type. In more realistic code, Rust can often infer the type of value we want to store once we insert values, so you rarely need to do this type annotation. It’s more -common to create a `Vec` that has initial values, and Rust provides the `vec!` -macro for convenience. The macro will create a new `Vec` that holds the values -we give it. Listing 8-2 creates a new `Vec` that holds the values `1`, -`2`, and `3`: +common to create a `Vec` that has initial values, and Rust provides the +`vec!` macro for convenience. The macro will create a new vector that holds the +values we give it. Listing 8-2 creates a new `Vec` that holds the values +`1`, `2`, and `3`: ```rust let v = vec![1, 2, 3]; diff --git a/second-edition/src/ch08-02-strings.md b/second-edition/src/ch08-02-strings.md index 44f018400..0b4d6e5c1 100644 --- a/second-edition/src/ch08-02-strings.md +++ b/second-edition/src/ch08-02-strings.md @@ -86,7 +86,7 @@ a `String` from a string literal Because strings are used for so many things, we can use many different generic APIs for strings, providing us with a lot of options. Some of them can seem redundant, but they all have their place! In this case, `String::from` and -`.to_string` do the same thing, so which you choose is a matter of style. +`to_string` do the same thing, so which you choose is a matter of style. Remember that strings are UTF-8 encoded, so we can include any properly encoded data in them, as shown in Listing 8-12: diff --git a/second-edition/src/ch08-03-hash-maps.md b/second-edition/src/ch08-03-hash-maps.md index 6c22b3488..6ac862a32 100644 --- a/second-edition/src/ch08-03-hash-maps.md +++ b/second-edition/src/ch08-03-hash-maps.md @@ -14,12 +14,12 @@ a team’s name and the values are each team’s score. Given a team name, you c retrieve its score. We’ll go over the basic API of hash maps in this section, but many more goodies -are hiding in the functions defined on `HashMap` by the standard library. As -always, check the standard library documentation for more information. +are hiding in the functions defined on `HashMap` by the standard library. +As always, check the standard library documentation for more information. ### Creating a New Hash Map -We can create an empty `HashMap` with `new` and add elements with `insert`. In +We can create an empty hash map with `new` and add elements with `insert`. In Listing 8-18, we’re keeping track of the scores of two teams whose names are Blue and Yellow. The Blue team will start with 10 points, and the Yellow team starts with 50: