diff options
Diffstat (limited to 'src/result.rs')
| -rw-r--r-- | src/result.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/result.rs b/src/result.rs index d5de01b..94ebab2 100644 --- a/src/result.rs +++ b/src/result.rs @@ -4,7 +4,9 @@ use std::error::Error; use crate::{unexpected::Errorable, UnexpectedError}; #[cfg(feature = "std")] -trait ResultErrorExt<T> { +pub trait ResultErrorExt<T> { + /// Converts `Result<T, E>` to `Result<T, UnexpectedError>`. + #[allow(clippy::missing_errors_doc)] fn unexpect(self) -> Result<T, UnexpectedError>; } @@ -15,7 +17,12 @@ impl<T, E: Error + Send + Sync + 'static> ResultErrorExt<T> for Result<T, E> { } } -trait ResultMsgExt<T> { +pub trait ResultMsgExt<T> { + /// Converts `Result<T, E>` to `Result<T, UnexpectedError>`. + /// + /// This is provided for compatibility with `no_std`. If your type + /// implements [`Error`], then you should prefer that instead. + #[allow(clippy::missing_errors_doc)] fn unexpect_msg(self) -> Result<T, UnexpectedError>; } |
