mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
Fix signature of Result in tasks tutorial. Closes #8343
This commit is contained in:
parent
348d844673
commit
3073ba4ca3
@ -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
Block a user