xous-core/services/shellchat/src/cmds/test.rs
2021-03-11 22:54:24 +08:00

27 lines
No EOL
576 B
Rust

use crate::{ShellCmdApi,CommonEnv};
use xous::String;
#[derive(Debug)]
pub struct Test {
state: u32
}
impl Test {
pub fn new() -> Self {
Test {
state: 0
}
}
}
impl<'a> ShellCmdApi<'a> for Test {
cmd_api!(test);
fn process(&mut self, _args: String::<1024>, _env: &mut CommonEnv) -> Result<Option<String::<1024>>, xous::Error> {
use core::fmt::Write;
self.state += 1;
let mut ret = String::<1024>::new();
write!(ret, "Test has run {} times.", self.state).unwrap();
Ok(Some(ret))
}
}