Tools for running RIOT’s built-in shell
This module can be used in two ways:
Declare static commands using
static_command!; these only take a
fn(not a closure) because shell commands don’t have an arg pointer.
This works even in RIOT modules that are included in a C application that starts a shell, and show up in shells created through Rust without explicit inclusion.
Quite a bit of complexity in this module is due to building the array of commands, and
moreover, creating trampoline functions that go through a global mutex to get a hold of the
command list – an exercise necessary due to the RIOT commands’ lack of a
argument. This does allow the Rust wrappers to “just so” use a closure as a command handler,
but also needs a lot of code.
That complexity is not pulled in when only using
and running on an otherwise empty command list.
- Newtype around an (argc, argv) C style string array that presents itself as much as an
&'a [&'a str]as possible. (Slicing is not implemented for reasons of laziness).
- Internal helper that is used to create the linear
riot_sys::shell_command_tstructure that a command list needs to pass to RIOT
- Internal helper that holds the data assembled using the
- A list of commands that can be presented as a shell prompt
- Something that can build a suitable command array for itself and its next commands using
- Start a blank list of commands