serialtui 0.1.3

A TUI environment specific to serial connections
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pub(crate) mod command_manager;

use async_trait::async_trait;

#[async_trait]
pub trait Command {
    fn get_name(&self) -> &'static str;
    fn get_args(&self) -> Vec<&'static str>;

    fn validate(&self, tokens: &Vec<&str>) -> bool {
        tokens.len() == 1 && tokens.last().unwrap() == &self.get_name()
    }

    async fn run(&self, args: Vec<String>) -> Vec<u8>;
}