~ruther/map-led-strip

ref: b96d6d8db3856bf4056a9092185fb9ffbb69a6af map-led-strip/src/commands/hello_world_command.rs -rw-r--r-- 690 bytes
b96d6d8d — František Boháček refactor: remove body of specific commands, do not expose fields of structs publicly... 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use esp_println::{print, println};
use crate::command_handler::{CommandHandleError, SpecificCommandHandler};
use crate::commands::command_data::CommandData;

#[derive(Default)]
pub struct HelloWorldCommand;

impl SpecificCommandHandler for HelloWorldCommand
{
    fn handle(&self, command: CommandData) -> Result<(), CommandHandleError>
    {
        let command = command.command();
        let full = command.full();
        print!("Hello world!");
        for c in &full[command.parsed_arguments()[0].data.len()..] {
            print!("{}", c);
        }
        println!("\r");

        Ok(())
    }

    fn help(&self) -> &'static str {
        "<x> - prints Hello world! <x>"
    }
}
Do not follow this link