summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/result.rs11
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