[][src]Macro kubos_app::app_main

macro_rules! app_main {
    ($handler:expr) => { ... };
}

A helper macro which detects the requested run level and calls the appropriate handler function

Arguments

Examples

use failure::Error;
use kubos_app::{AppHandler, app_main};

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(())
}