25 lines
498 B
Rust
25 lines
498 B
Rust
#[macro_export]
|
|
macro_rules! push_error_task {
|
|
($e:expr) => {
|
|
iced::Task::done(push_error!($e))
|
|
};
|
|
}
|
|
|
|
#[macro_export]
|
|
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)
|
|
}
|
|
}
|