Improve try! docs to make clearer it returns Result.
The API documentation is not explicit enough that because `try!` returns `Err` early for you, you can only use it in functions that return `Result`. The book mentions this, but if you come across `try!` outside of the book and look it up in the docs, this restriction on the return type of the function is not particularly clear.
This commit is contained in:
@@ -223,7 +223,9 @@
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! `try!` is imported by the prelude, and is available everywhere.
|
||||
//! `try!` is imported by the prelude and is available everywhere, but it can only
|
||||
//! be used in functions that return `Result` because of the early return of
|
||||
//! `Err` that it provides.
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user