Rewrite the project
The previous project architecture was far too complicated and hard to maintain. The new one is much more simple. Although procedural macros are cools, they are a no-go on Rust-OpenSMTPD. Reports and filter are implemented (except data-line) but untested.
This commit is contained in:
parent
fc072743ad
commit
a6d4dd21c1
48 changed files with 1723 additions and 1493 deletions
31
src/data_structures/auth_result.rs
Normal file
31
src/data_structures/auth_result.rs
Normal file
|
@ -0,0 +1,31 @@
|
|||
use std::str::FromStr;
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub enum AuthResult {
|
||||
Pass,
|
||||
Fail,
|
||||
Error,
|
||||
}
|
||||
|
||||
impl ToString for AuthResult {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
AuthResult::Pass => String::from("pass"),
|
||||
AuthResult::Fail => String::from("fail"),
|
||||
AuthResult::Error => String::from("error"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for AuthResult {
|
||||
type Err = ();
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
"pass" => Ok(AuthResult::Pass),
|
||||
"fail" => Ok(AuthResult::Fail),
|
||||
"error" => Ok(AuthResult::Error),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue