mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 19:54:34 -06:00
Merge pull request #522 from gypsydave5/chapter_number_fixes
Chapter number fixes
This commit is contained in:
@@ -59,7 +59,7 @@ Next, we create an iterator over the array of bytes using the `iter` method :
|
||||
for (i, &item) in bytes.iter().enumerate() {
|
||||
```
|
||||
|
||||
We’ll discuss iterators in more detail in Chapter 16. For now, know that `iter`
|
||||
We’ll discuss iterators in more detail in Chapter 13. For now, know that `iter`
|
||||
is a method that returns each element in a collection, and `enumerate` wraps
|
||||
the result of `iter` and returns each element as part of a tuple instead. The
|
||||
first element of the returned tuple is the index, and the second element is a
|
||||
|
||||
@@ -5,7 +5,7 @@ their name, they can have parameters and return values, and they contain some
|
||||
code that gets run when they’re called from somewhere else. Methods are
|
||||
different from functions, however, because they’re defined within the context
|
||||
of a struct (or an enum or a trait object, which we will cover in Chapters 6
|
||||
and 13, respectively), and their first parameter is always `self`, which
|
||||
and 17, respectively), and their first parameter is always `self`, which
|
||||
represents the instance of the struct that the method is being called on.
|
||||
|
||||
### Defining Methods
|
||||
|
||||
@@ -153,7 +153,7 @@ mod tests {
|
||||
}
|
||||
```
|
||||
|
||||
We’ll explain more about testing in Chapter 12, but parts of this should make
|
||||
We’ll explain more about testing in Chapter 11, but parts of this should make
|
||||
sense now: we have a module named `tests` that lives next to our other modules
|
||||
and contains one function named `it_works`. Even though there are special
|
||||
annotations, the `tests` module is just another module! So our module hierarchy
|
||||
|
||||
Reference in New Issue
Block a user