diff options
| author | Botahamec <botahamec@outlook.com> | 2022-10-23 12:51:39 -0400 |
|---|---|---|
| committer | Botahamec <botahamec@outlook.com> | 2022-10-23 12:51:39 -0400 |
| commit | f52dc60a3c83d43be2b9df0e4a6e4fa0d704a7b3 (patch) | |
| tree | 011ce9feaaaea65b4ec642c2631b09fb65afdef5 | |
| parent | c089a353ae1c30edfeb794b7b3bdd0d225766865 (diff) | |
Seal the Result extensions
| -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 94ebab2..03483d2 100644 --- a/src/result.rs +++ b/src/result.rs @@ -3,8 +3,15 @@ use std::error::Error; use crate::{unexpected::Errorable, UnexpectedError}; +mod sealed { + pub trait Sealed {} + impl<T, E> Sealed for Result<T, E> {} +} + +use sealed::Sealed; + #[cfg(feature = "std")] -pub trait ResultErrorExt<T> { +pub trait ResultErrorExt<T>: Sealed { /// Converts `Result<T, E>` to `Result<T, UnexpectedError>`. #[allow(clippy::missing_errors_doc)] fn unexpect(self) -> Result<T, UnexpectedError>; @@ -17,7 +24,7 @@ impl<T, E: Error + Send + Sync + 'static> ResultErrorExt<T> for Result<T, E> { } } -pub trait ResultMsgExt<T> { +pub trait ResultMsgExt<T>: Sealed { /// Converts `Result<T, E>` to `Result<T, UnexpectedError>`. /// /// This is provided for compatibility with `no_std`. If your type |
