Introduce MaybeError type
This commit is contained in:
1 parent
d836b57d2a
commit
a60ed37cd4
16 files changed
+127
-93
No files matched your search
@@ -10,4 +10,14 @@ macro_rules! push_error {
|
||||
($e:expr) => {
|
||||
$crate::navigation::RootMessage::PushNotification($crate::notification::NotificationRequest::Error($e))
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn into_result<R, E>(option: Option<R>, error: E) -> Result<R, E>{
|
||||
if let Some(r) = option {
|
||||
Ok(r)
|
||||
}
|
||||
else {
|
||||
Err(error)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user