Macro implement_executable_device

Source
macro_rules! implement_executable_device {
    (
        Structure: $struct_name:ident,
        Mount_path: $mount_path:expr,
        Main_function: $main_function:path,
    ) => { ... };
}
Expand description

Macro to automatically implement DeviceExecutableTrait for a struct with a main function.

This macro generates both the DeviceExecutableTrait implementation and the DeviceTrait implementation for executable devices.

ยงUsage

For simple executables:

extern crate alloc;

pub struct MyExecutableType;

async fn my_main_function(
    standard: executable::Standard,
    arguments: String
) -> Result<(), core::num::NonZeroUsize> {
   standard.print_line(&arguments);

   Ok(())
}

executable::implement_executable_device!(
    Structure: MyExecutableType,
    Mount_path: "/binaries/MyExecutable",
    Main_function: my_main_function,
);