botx_api_framework/results/
command.rs1
2
3pub type CommandResult = Result<CommandOk, CommandError>;
4
5#[derive(Debug)]
6pub struct CommandOk {
7 pub result: String,
8}
9
10impl CommandOk {
11 pub fn new<TResult: Into<String>>(result: TResult) -> Self { Self { result: result.into() } }
12}
13
14impl Default for CommandOk {
15 fn default() -> Self {
16 Self { result: "accepted".to_string() }
17 }
18}
19
20#[derive(Debug)]
21pub struct CommandError {
22 pub reason: String,
24
25 pub status_message: String,
27}
28
29impl CommandError {
30 pub fn new(reason: String, status_message: String) -> Self { Self { reason, status_message } }
31}
32