Macro kubos_app::app_main [−][src]
macro_rules! app_main { ($handler:expr) => { ... }; }
A helper macro which detects the requested run level and calls the appropriate handler function
Arguments
handler
- A reference to an object which implements the run level handler functions
Examples
extern crate failure; #[macro_use] extern crate kubos_app; use failure::Error; use kubos_app::AppHandler; struct MyApp; impl AppHandler for MyApp { fn on_boot(&self, _args: Vec<String>) -> Result<(), Error> { println!("OnBoot logic"); Ok(()) } fn on_command(&self, _args: Vec<String>) -> Result<(), Error> { println!("OnCommand logic"); Ok(()) } } fn main() -> Result<(), Error> { let app = MyApp { }; app_main!(&app)?; Ok(()) }