auto merge of #9450 : jzelinskie/rust/tutorial-tasks-result-signature, r=alexcrichton
This commit is contained in:
commit
0275b1c404
|
@ -423,7 +423,7 @@ do_some_work();
|
||||||
While it isn't possible for a task to recover from failure, tasks may notify
|
While it isn't possible for a task to recover from failure, tasks may notify
|
||||||
each other of failure. The simplest way of handling task failure is with the
|
each other of failure. The simplest way of handling task failure is with the
|
||||||
`try` function, which is similar to `spawn`, but immediately blocks waiting
|
`try` function, which is similar to `spawn`, but immediately blocks waiting
|
||||||
for the child task to finish. `try` returns a value of type `Result<int,
|
for the child task to finish. `try` returns a value of type `Result<T,
|
||||||
()>`. `Result` is an `enum` type with two variants: `Ok` and `Err`. In this
|
()>`. `Result` is an `enum` type with two variants: `Ok` and `Err`. In this
|
||||||
case, because the type arguments to `Result` are `int` and `()`, callers can
|
case, because the type arguments to `Result` are `int` and `()`, callers can
|
||||||
pattern-match on a result to check whether it's an `Ok` result with an `int`
|
pattern-match on a result to check whether it's an `Ok` result with an `int`
|
||||||
|
|
Loading…
Reference in New Issue