summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib.rs4
-rw-r--r--src/result.rs11
2 files changed, 13 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 20d9580..70555a0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,5 +13,9 @@ mod result;
mod unexpected;
pub use exun::*;
+#[cfg(feature = "std")]
+pub use result::ResultErrorExt;
+#[cfg(feature = "alloc")]
+pub use result::ResultMsgExt;
#[cfg(feature = "alloc")]
pub use unexpected::UnexpectedError;
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>;
}