2026-08-24 18:16:41 +03:00
|
|
|
#[macro_export]
|
|
|
|
|
macro_rules! push_error_task {
|
|
|
|
|
($e:expr) => {
|
|
|
|
|
iced::Task::done(push_error!($e))
|
2026-08-25 12:04:07 +03:00
|
|
|
};
|
2026-08-24 18:16:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
|
macro_rules! push_error {
|
|
|
|
|
($e:expr) => {
|
2026-08-25 12:04:07 +03:00
|
|
|
$crate::navigation::RootMessage::PushNotification(
|
|
|
|
|
$crate::notification::NotificationRequest::Error($e),
|
|
|
|
|
)
|
|
|
|
|
};
|
2026-08-24 23:42:58 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[inline(always)]
|
2026-08-25 12:04:07 +03:00
|
|
|
pub fn into_result<R, E>(option: Option<R>, error: E) -> Result<R, E> {
|
2026-08-24 23:42:58 +03:00
|
|
|
if let Some(r) = option {
|
|
|
|
|
Ok(r)
|
2026-08-25 12:04:07 +03:00
|
|
|
} else {
|
2026-08-24 23:42:58 +03:00
|
|
|
Err(error)
|
|
|
|
|
}
|
2026-08-25 12:04:07 +03:00
|
|
|
}
|