use crate::app::Action; use tokio::sync::mpsc::{self, error::SendError}; // TODO: Put this somewhere closer to the procedural macro definitions pub trait Component { fn handle_action( &mut self, action: T, tx: &'static mpsc::UnboundedSender, ) -> Result<(), SendError>; } #[allow(unused_macros)] #[macro_export] macro_rules! status_info { ($action_tx:expr, $text:expr $(, $args:expr)*) => { $action_tx.send( crate::app::GlobalAction::ShowStatMsg( crate::app::StatusMessage::Info(format!($text, $($args)*))) .into(), ) }; } #[allow(unused_macros)] #[macro_export] macro_rules! status_warn { ($action_tx:expr, $text:expr $(, $args:expr)*) => { $action_tx.send( crate::app::GlobalAction::ShowStatMsg( crate::app::StatusMessage::Info(format!($text, $($args)*))) .into(), ) }; } #[allow(unused_macros)] #[macro_export] macro_rules! status_error { ($action_tx:expr, $text:expr $(, $args:expr)*) => { $action_tx.send( crate::app::GlobalAction::ShowStatMsg( crate::app::StatusMessage::Info(format!($text, $($args)*))) .into(), ) }; }