riot_module_shell
only.Expand description
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 afn
(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.
-
Use new to start building a CommandList. This can have full closures as commands, but these are available only when the shell is then started through the CommandList’s run methods.
§Note on complexity of this module
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 *void data
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 static_command!
and running on an otherwise empty command list.
Modules§
- args 🔒
Structs§
- 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). - Iterator of Args, created using Args::iter()
- Internal helper that is used to create the linear
riot_sys::shell_command_t
structure that a command list needs to pass to RIOT - Internal helper that holds the data assembled using the
CommandList::and
builder
Statics§
Traits§
- 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
shell_run_once
etc.
Functions§
- Start a blank list of commands