riot_wrappers::shell

Trait CommandListInternals

Source
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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§