src/structs/messagetext.rs
22 lines · 455 bytes
1#[derive(Clone, PartialEq, Eq)]
2pub enum MessageText {
3 Command(String),
4 Text(String),
5 None,
6}
7
8impl ToString for MessageText {
9 fn to_string(&self) -> String {
10 match self {
11 Self::Command(cmd) => format!(":{}", cmd),
12 Self::Text(s) => s.clone(),
13 Self::None => String::from("All good :)"),
14 }
15 }
16}
17
18impl MessageText {
19 pub fn is_some(&self) -> bool{
20 *self != Self::None
21 }
22}