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
use std::str::FromStr;

#[derive(Clone, Debug, Eq, PartialEq)]
pub enum SubSystem {
    SmtpIn,
}

impl ToString for SubSystem {
    fn to_string(&self) -> String {
        match self {
            SubSystem::SmtpIn => String::from("smtp-in"),
        }
    }
}

impl FromStr for SubSystem {
    type Err = ();

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s {
            "smtp-in" => Ok(SubSystem::SmtpIn),
            _ => Err(()),
        }
    }
}