diff options
| author | masklinn <github.com@masklinn.net> | 2014-07-12 17:02:15 +0200 |
|---|---|---|
| committer | masklinn <bitbucket.org@masklinn.net> | 2014-07-14 10:20:29 +0200 |
| commit | ded48c5847b57262eb831c5d4201761b6bf36b3f (patch) | |
| tree | 199ebe59e61b7db2bae17d393cc3abffc94e7057 | |
| parent | da4e4e4e0a7778a85748aa4a303b13f603e96b4b (diff) | |
| download | rust-ded48c5847b57262eb831c5d4201761b6bf36b3f.tar.gz rust-ded48c5847b57262eb831c5d4201761b6bf36b3f.zip | |
Document that Result.unwrap prints the Err's value
It is implied by the Show bound, but that implication can be missed.
| -rw-r--r-- | src/libcore/result.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 32e1d570be3..980a9c7506f 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -536,7 +536,10 @@ impl<T, E> Result<T, E> { impl<T, E: Show> Result<T, E> { /// Unwraps a result, yielding the content of an `Ok`. /// - /// Fails if the value is an `Err`. + /// # Failure + /// + /// Fails if the value is an `Err`, with a custom failure message provided + /// by the `Err`'s value. #[inline] pub fn unwrap(self) -> T { match self { @@ -550,7 +553,10 @@ impl<T, E: Show> Result<T, E> { impl<T: Show, E> Result<T, E> { /// Unwraps a result, yielding the content of an `Err`. /// - /// Fails if the value is an `Ok`. + /// # Failure + /// + /// Fails if the value is an `Ok`, with a custom failure message provided + /// by the `Ok`'s value. #[inline] pub fn unwrap_err(self) -> E { match self { |
