Skip to content

Commit

Permalink
Merge pull request #1377 from asgii/patch-1
Browse files Browse the repository at this point in the history
Tweak description of ? operator
  • Loading branch information
steveklabnik authored Jun 1, 2018
2 parents 88c545d + 3e96881 commit 69990bb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions 2018-edition/src/ch09-02-recoverable-errors-with-result.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,12 @@ The `?` placed after a `Result` value is defined to work in almost the same way
as the `match` expressions we defined to handle the `Result` values in Listing
9-6. If the value of the `Result` is an `Ok`, the value inside the `Ok` will
get returned from this expression, and the program will continue. If the value
is an `Err`, the value inside the `Err` will be returned from the whole
function as if we had used the `return` keyword so the error value gets
propagated to the calling code.
is an `Err`, the `Err` will be returned from the whole function as if we had
used the `return` keyword so the error value gets propagated to the calling
code.

There is a difference between what the `match` expression from Listing 9-6 and
`?` do: error values used with `?` go through the `from` function, defined in
`?` do: error values taken by `?` go through the `from` function, defined in
the `From` trait in the standard library, which is used to convert errors from
one type into another. When `?` calls the `from` function, the error type
received is converted into the error type defined in the return type of the
Expand Down

0 comments on commit 69990bb

Please sign in to comment.