pub unsafe trait CommandListInternals: Sized {
    type Built: 'static;

    // Required methods
    fn build_shell_command<Root: CommandListInternals>(&self) -> Self::Built;
    fn find_self_and_run(
        &mut self,
        argc: i32,
        argv: *mut *mut c_char,
        command_index: usize
    ) -> i32;

    // Provided methods
    fn run_any<R, F: Fn(*const shell_command_t, *mut c_char, i32) -> R>(
        &mut self,
        linebuffer: &mut [u8],
        cb: F
    ) -> R { ... }
    fn find_root_and_run(
        argc: i32,
        argv: *mut *mut c_char,
        command_index: usize
    ) -> i32 { ... }
}
Available on riot_module_shell only.
Expand description

Something that can build a suitable command array for itself and its next commands using shell_run_once etc.

This is unsafe to impleemnt as all implementers must guarantee that a reference to the Built type can be cast to a shell_command_t and that all commands in there are contiguous up until a nulled one.

Required Associated Types§

source

type Built: 'static

Required Methods§

source

fn build_shell_command<Root: CommandListInternals>(&self) -> Self::Built

source

fn find_self_and_run( &mut self, argc: i32, argv: *mut *mut c_char, command_index: usize ) -> i32

Run your own callback with argc and argv if the called argument is what the implementation put into its own entry of its Built, or defer to its next.

Provided Methods§

source

fn run_any<R, F: Fn(*const shell_command_t, *mut c_char, i32) -> R>( &mut self, linebuffer: &mut [u8], cb: F ) -> R

source

fn find_root_and_run( argc: i32, argv: *mut *mut c_char, command_index: usize ) -> i32

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, Next, H, T> CommandListInternals for Command<'a, Next, H, T>
where Next: CommandListInternals, H: FnMut(&mut Stdio, Args<'_>) -> T, T: Termination,