From a9f00c924fc816bd8103b4b05574f02fc4d1966f Mon Sep 17 00:00:00 2001 From: Botahamec Date: Wed, 9 Aug 2023 09:55:12 -0400 Subject: Allow the ResultExunExt to be used without alloc --- src/result.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/result.rs') diff --git a/src/result.rs b/src/result.rs index d876a0c..344de5b 100644 --- a/src/result.rs +++ b/src/result.rs @@ -66,12 +66,14 @@ impl ResultErrorExt for Result { } } +#[cfg(feature = "alloc")] impl ResultErrorExt for Result { fn unexpect(self) -> Self { self } } +#[cfg(feature = "alloc")] impl ResultErrorExt for Option { fn unexpect(self) -> Result { self.ok_or_else(RawUnexpected::none) @@ -81,6 +83,7 @@ impl ResultErrorExt for Option { /// Provides [`Result::unexpect_msg`] /// /// [`Result::unexpect_msg`]: `ResultMsgExt::unexpect_msg` +#[cfg(feature = "alloc")] pub trait ResultMsgExt: Sealed { /// Converts [`Result`] to [`Result`]. /// @@ -123,6 +126,7 @@ pub trait ResultMsgExt: Sealed { fn unexpect_msg(self) -> Result; } +#[cfg(feature = "alloc")] impl ResultMsgExt for Result { fn unexpect_msg(self) -> Result { self.map_err(RawUnexpected::msg) -- cgit v1.2.3