msg_auth_status/dkim/version.rs
1//! DKIM Version
2
3/// DKIM Version
4#[derive(Clone, Debug, PartialEq)]
5pub enum DkimVersion<'hdr> {
6 /// RFC just says this should be used
7 One,
8 /// Something else outside RFC
9 Unknown(&'hdr str),
10}
11
12use crate::error::DkimVersionError;
13
14impl<'hdr> TryFrom<&'hdr str> for DkimVersion<'hdr> {
15 type Error = DkimVersionError;
16
17 fn try_from(in_str: &'hdr str) -> Result<Self, Self::Error> {
18 let ret = match in_str {
19 "1" => Self::One,
20 _ => Self::Unknown(in_str),
21 };
22 Ok(ret)
23 }
24}