diff --git a/rtc_types/src/ecall_result.rs b/rtc_types/src/ecall_result.rs index 5e2f0eca..ece1f397 100644 --- a/rtc_types/src/ecall_result.rs +++ b/rtc_types/src/ecall_result.rs @@ -8,6 +8,17 @@ pub enum EcallResult { Err(E), } +impl EcallResult { + /// See [`Result::map`] + pub fn map U>(self, op: F) -> EcallResult { + use EcallResult::{Err, Ok}; + match self { + Ok(t) => Ok(op(t)), + Err(e) => Err(e), + } + } +} + impl EcallResult where E: 'static + std::error::Error + Display,