Migration implementation (part 1)
This commit is contained in:
@@ -19,7 +19,24 @@ pub const NOTJUNK: usize = 8;
|
||||
pub const DELETED: usize = 9;
|
||||
pub const FORWARDED: usize = 10;
|
||||
pub const MDN_SENT: usize = 11;
|
||||
pub const OTHER: usize = 12;
|
||||
pub const AUTOSENT: usize = 12;
|
||||
pub const CANUNSUBSCRIBE: usize = 13;
|
||||
pub const FOLLOWED: usize = 14;
|
||||
pub const HASATTACHMENT: usize = 15;
|
||||
pub const HASMEMO: usize = 16;
|
||||
pub const HASNOATTACHMENT: usize = 17;
|
||||
pub const IMPORTED: usize = 18;
|
||||
pub const ISTRUSTED: usize = 19;
|
||||
pub const MAILFLAGBIT0: usize = 20;
|
||||
pub const MAILFLAGBIT1: usize = 21;
|
||||
pub const MAILFLAGBIT2: usize = 22;
|
||||
pub const MASKEDEMAIL: usize = 23;
|
||||
pub const MEMO: usize = 24;
|
||||
pub const MUTED: usize = 25;
|
||||
pub const NEW: usize = 26;
|
||||
pub const NOTIFY: usize = 27;
|
||||
pub const UNSUBSCRIBED: usize = 28;
|
||||
pub const OTHER: usize = 29;
|
||||
|
||||
#[derive(
|
||||
rkyv::Serialize,
|
||||
@@ -64,6 +81,40 @@ pub enum Keyword {
|
||||
Forwarded,
|
||||
#[serde(rename(serialize = "$mdnsent"))]
|
||||
MdnSent,
|
||||
#[serde(rename(serialize = "$autosent"))]
|
||||
Autosent,
|
||||
#[serde(rename(serialize = "$canunsubscribe"))]
|
||||
CanUnsubscribe,
|
||||
#[serde(rename(serialize = "$followed"))]
|
||||
Followed,
|
||||
#[serde(rename(serialize = "$hasattachment"))]
|
||||
HasAttachment,
|
||||
#[serde(rename(serialize = "$hasmemo"))]
|
||||
HasMemo,
|
||||
#[serde(rename(serialize = "$hasnoattachment"))]
|
||||
HasNoAttachment,
|
||||
#[serde(rename(serialize = "$imported"))]
|
||||
Imported,
|
||||
#[serde(rename(serialize = "$istrusted"))]
|
||||
IsTrusted,
|
||||
#[serde(rename(serialize = "$MailFlagBit0"))]
|
||||
MailFlagBit0,
|
||||
#[serde(rename(serialize = "$MailFlagBit1"))]
|
||||
MailFlagBit1,
|
||||
#[serde(rename(serialize = "$MailFlagBit2"))]
|
||||
MailFlagBit2,
|
||||
#[serde(rename(serialize = "$maskedemail"))]
|
||||
MaskedEmail,
|
||||
#[serde(rename(serialize = "$memo"))]
|
||||
Memo,
|
||||
#[serde(rename(serialize = "$muted"))]
|
||||
Muted,
|
||||
#[serde(rename(serialize = "$new"))]
|
||||
New,
|
||||
#[serde(rename(serialize = "$notify"))]
|
||||
Notify,
|
||||
#[serde(rename(serialize = "$unsubscribed"))]
|
||||
Unsubscribed,
|
||||
}
|
||||
|
||||
impl Keyword {
|
||||
@@ -107,7 +158,24 @@ impl Keyword {
|
||||
"notjunk" => Keyword::NotJunk,
|
||||
"deleted" => Keyword::Deleted,
|
||||
"forwarded" => Keyword::Forwarded,
|
||||
"mdnsent" => Keyword::MdnSent
|
||||
"mdnsent" => Keyword::MdnSent,
|
||||
"autosent" => Keyword::Autosent,
|
||||
"canunsubscribe" => Keyword::CanUnsubscribe,
|
||||
"followed" => Keyword::Followed,
|
||||
"hasattachment" => Keyword::HasAttachment,
|
||||
"hasmemo" => Keyword::HasMemo,
|
||||
"hasnoattachment" => Keyword::HasNoAttachment,
|
||||
"imported" => Keyword::Imported,
|
||||
"istrusted" => Keyword::IsTrusted,
|
||||
"mailflagbit0" => Keyword::MailFlagBit0,
|
||||
"mailflagbit1" => Keyword::MailFlagBit1,
|
||||
"mailflagbit2" => Keyword::MailFlagBit2,
|
||||
"maskedemail" => Keyword::MaskedEmail,
|
||||
"memo" => Keyword::Memo,
|
||||
"muted" => Keyword::Muted,
|
||||
"new" => Keyword::New,
|
||||
"notify" => Keyword::Notify,
|
||||
"unsubscribed" => Keyword::Unsubscribed,
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -126,6 +194,23 @@ impl Keyword {
|
||||
Keyword::Deleted => Ok(DELETED as u32),
|
||||
Keyword::Forwarded => Ok(FORWARDED as u32),
|
||||
Keyword::MdnSent => Ok(MDN_SENT as u32),
|
||||
Keyword::Autosent => Ok(AUTOSENT as u32),
|
||||
Keyword::CanUnsubscribe => Ok(CANUNSUBSCRIBE as u32),
|
||||
Keyword::Followed => Ok(FOLLOWED as u32),
|
||||
Keyword::HasAttachment => Ok(HASATTACHMENT as u32),
|
||||
Keyword::HasMemo => Ok(HASMEMO as u32),
|
||||
Keyword::HasNoAttachment => Ok(HASNOATTACHMENT as u32),
|
||||
Keyword::Imported => Ok(IMPORTED as u32),
|
||||
Keyword::IsTrusted => Ok(ISTRUSTED as u32),
|
||||
Keyword::MailFlagBit0 => Ok(MAILFLAGBIT0 as u32),
|
||||
Keyword::MailFlagBit1 => Ok(MAILFLAGBIT1 as u32),
|
||||
Keyword::MailFlagBit2 => Ok(MAILFLAGBIT2 as u32),
|
||||
Keyword::MaskedEmail => Ok(MASKEDEMAIL as u32),
|
||||
Keyword::Memo => Ok(MEMO as u32),
|
||||
Keyword::Muted => Ok(MUTED as u32),
|
||||
Keyword::New => Ok(NEW as u32),
|
||||
Keyword::Notify => Ok(NOTIFY as u32),
|
||||
Keyword::Unsubscribed => Ok(UNSUBSCRIBED as u32),
|
||||
Keyword::Other(string) => Err(string.as_ref()),
|
||||
}
|
||||
}
|
||||
@@ -144,6 +229,23 @@ impl Keyword {
|
||||
Keyword::Deleted => Ok(DELETED as u32),
|
||||
Keyword::Forwarded => Ok(FORWARDED as u32),
|
||||
Keyword::MdnSent => Ok(MDN_SENT as u32),
|
||||
Keyword::Autosent => Ok(AUTOSENT as u32),
|
||||
Keyword::CanUnsubscribe => Ok(CANUNSUBSCRIBE as u32),
|
||||
Keyword::Followed => Ok(FOLLOWED as u32),
|
||||
Keyword::HasAttachment => Ok(HASATTACHMENT as u32),
|
||||
Keyword::HasMemo => Ok(HASMEMO as u32),
|
||||
Keyword::HasNoAttachment => Ok(HASNOATTACHMENT as u32),
|
||||
Keyword::Imported => Ok(IMPORTED as u32),
|
||||
Keyword::IsTrusted => Ok(ISTRUSTED as u32),
|
||||
Keyword::MailFlagBit0 => Ok(MAILFLAGBIT0 as u32),
|
||||
Keyword::MailFlagBit1 => Ok(MAILFLAGBIT1 as u32),
|
||||
Keyword::MailFlagBit2 => Ok(MAILFLAGBIT2 as u32),
|
||||
Keyword::MaskedEmail => Ok(MASKEDEMAIL as u32),
|
||||
Keyword::Memo => Ok(MEMO as u32),
|
||||
Keyword::Muted => Ok(MUTED as u32),
|
||||
Keyword::New => Ok(NEW as u32),
|
||||
Keyword::Notify => Ok(NOTIFY as u32),
|
||||
Keyword::Unsubscribed => Ok(UNSUBSCRIBED as u32),
|
||||
Keyword::Other(string) => Err(string),
|
||||
}
|
||||
}
|
||||
@@ -162,6 +264,23 @@ impl Keyword {
|
||||
DELETED => Ok(Keyword::Deleted),
|
||||
FORWARDED => Ok(Keyword::Forwarded),
|
||||
MDN_SENT => Ok(Keyword::MdnSent),
|
||||
AUTOSENT => Ok(Keyword::Autosent),
|
||||
CANUNSUBSCRIBE => Ok(Keyword::CanUnsubscribe),
|
||||
FOLLOWED => Ok(Keyword::Followed),
|
||||
HASATTACHMENT => Ok(Keyword::HasAttachment),
|
||||
HASMEMO => Ok(Keyword::HasMemo),
|
||||
HASNOATTACHMENT => Ok(Keyword::HasNoAttachment),
|
||||
IMPORTED => Ok(Keyword::Imported),
|
||||
ISTRUSTED => Ok(Keyword::IsTrusted),
|
||||
MAILFLAGBIT0 => Ok(Keyword::MailFlagBit0),
|
||||
MAILFLAGBIT1 => Ok(Keyword::MailFlagBit1),
|
||||
MAILFLAGBIT2 => Ok(Keyword::MailFlagBit2),
|
||||
MASKEDEMAIL => Ok(Keyword::MaskedEmail),
|
||||
MEMO => Ok(Keyword::Memo),
|
||||
MUTED => Ok(Keyword::Muted),
|
||||
NEW => Ok(Keyword::New),
|
||||
NOTIFY => Ok(Keyword::Notify),
|
||||
UNSUBSCRIBED => Ok(Keyword::Unsubscribed),
|
||||
_ => Err(id),
|
||||
}
|
||||
}
|
||||
@@ -188,6 +307,23 @@ impl Display for Keyword {
|
||||
Keyword::Deleted => write!(f, "$deleted"),
|
||||
Keyword::Forwarded => write!(f, "$forwarded"),
|
||||
Keyword::MdnSent => write!(f, "$mdnsent"),
|
||||
Keyword::Autosent => write!(f, "$autosent"),
|
||||
Keyword::CanUnsubscribe => write!(f, "$canunsubscribe"),
|
||||
Keyword::Followed => write!(f, "$followed"),
|
||||
Keyword::HasAttachment => write!(f, "$hasattachment"),
|
||||
Keyword::HasMemo => write!(f, "$hasmemo"),
|
||||
Keyword::HasNoAttachment => write!(f, "$hasnoattachment"),
|
||||
Keyword::Imported => write!(f, "$imported"),
|
||||
Keyword::IsTrusted => write!(f, "$istrusted"),
|
||||
Keyword::MailFlagBit0 => write!(f, "$MailFlagBit0"),
|
||||
Keyword::MailFlagBit1 => write!(f, "$MailFlagBit1"),
|
||||
Keyword::MailFlagBit2 => write!(f, "$MailFlagBit2"),
|
||||
Keyword::MaskedEmail => write!(f, "$maskedemail"),
|
||||
Keyword::Memo => write!(f, "$memo"),
|
||||
Keyword::Muted => write!(f, "$muted"),
|
||||
Keyword::New => write!(f, "$new"),
|
||||
Keyword::Notify => write!(f, "$notify"),
|
||||
Keyword::Unsubscribed => write!(f, "$unsubscribed"),
|
||||
Keyword::Other(s) => write!(f, "{}", s),
|
||||
}
|
||||
}
|
||||
@@ -208,6 +344,23 @@ impl Display for ArchivedKeyword {
|
||||
ArchivedKeyword::Deleted => write!(f, "$deleted"),
|
||||
ArchivedKeyword::Forwarded => write!(f, "$forwarded"),
|
||||
ArchivedKeyword::MdnSent => write!(f, "$mdnsent"),
|
||||
ArchivedKeyword::Autosent => write!(f, "$autosent"),
|
||||
ArchivedKeyword::CanUnsubscribe => write!(f, "$canunsubscribe"),
|
||||
ArchivedKeyword::Followed => write!(f, "$followed"),
|
||||
ArchivedKeyword::HasAttachment => write!(f, "$hasattachment"),
|
||||
ArchivedKeyword::HasMemo => write!(f, "$hasmemo"),
|
||||
ArchivedKeyword::HasNoAttachment => write!(f, "$hasnoattachment"),
|
||||
ArchivedKeyword::Imported => write!(f, "$imported"),
|
||||
ArchivedKeyword::IsTrusted => write!(f, "$istrusted"),
|
||||
ArchivedKeyword::MailFlagBit0 => write!(f, "$MailFlagBit0"),
|
||||
ArchivedKeyword::MailFlagBit1 => write!(f, "$MailFlagBit1"),
|
||||
ArchivedKeyword::MailFlagBit2 => write!(f, "$MailFlagBit2"),
|
||||
ArchivedKeyword::MaskedEmail => write!(f, "$maskedemail"),
|
||||
ArchivedKeyword::Memo => write!(f, "$memo"),
|
||||
ArchivedKeyword::Muted => write!(f, "$muted"),
|
||||
ArchivedKeyword::New => write!(f, "$new"),
|
||||
ArchivedKeyword::Notify => write!(f, "$notify"),
|
||||
ArchivedKeyword::Unsubscribed => write!(f, "$unsubscribed"),
|
||||
ArchivedKeyword::Other(s) => write!(f, "{}", s),
|
||||
}
|
||||
}
|
||||
@@ -228,6 +381,23 @@ impl From<Keyword> for Vec<u8> {
|
||||
Keyword::Deleted => vec![DELETED as u8],
|
||||
Keyword::Forwarded => vec![FORWARDED as u8],
|
||||
Keyword::MdnSent => vec![MDN_SENT as u8],
|
||||
Keyword::Autosent => vec![AUTOSENT as u8],
|
||||
Keyword::CanUnsubscribe => vec![CANUNSUBSCRIBE as u8],
|
||||
Keyword::Followed => vec![FOLLOWED as u8],
|
||||
Keyword::HasAttachment => vec![HASATTACHMENT as u8],
|
||||
Keyword::HasMemo => vec![HASMEMO as u8],
|
||||
Keyword::HasNoAttachment => vec![HASNOATTACHMENT as u8],
|
||||
Keyword::Imported => vec![IMPORTED as u8],
|
||||
Keyword::IsTrusted => vec![ISTRUSTED as u8],
|
||||
Keyword::MailFlagBit0 => vec![MAILFLAGBIT0 as u8],
|
||||
Keyword::MailFlagBit1 => vec![MAILFLAGBIT1 as u8],
|
||||
Keyword::MailFlagBit2 => vec![MAILFLAGBIT2 as u8],
|
||||
Keyword::MaskedEmail => vec![MASKEDEMAIL as u8],
|
||||
Keyword::Memo => vec![MEMO as u8],
|
||||
Keyword::Muted => vec![MUTED as u8],
|
||||
Keyword::New => vec![NEW as u8],
|
||||
Keyword::Notify => vec![NOTIFY as u8],
|
||||
Keyword::Unsubscribed => vec![UNSUBSCRIBED as u8],
|
||||
Keyword::Other(string) => string.as_bytes().to_vec(),
|
||||
}
|
||||
}
|
||||
@@ -256,6 +426,23 @@ impl ArchivedKeyword {
|
||||
ArchivedKeyword::Deleted => Ok(DELETED as u32),
|
||||
ArchivedKeyword::Forwarded => Ok(FORWARDED as u32),
|
||||
ArchivedKeyword::MdnSent => Ok(MDN_SENT as u32),
|
||||
ArchivedKeyword::Autosent => Ok(AUTOSENT as u32),
|
||||
ArchivedKeyword::CanUnsubscribe => Ok(CANUNSUBSCRIBE as u32),
|
||||
ArchivedKeyword::Followed => Ok(FOLLOWED as u32),
|
||||
ArchivedKeyword::HasAttachment => Ok(HASATTACHMENT as u32),
|
||||
ArchivedKeyword::HasMemo => Ok(HASMEMO as u32),
|
||||
ArchivedKeyword::HasNoAttachment => Ok(HASNOATTACHMENT as u32),
|
||||
ArchivedKeyword::Imported => Ok(IMPORTED as u32),
|
||||
ArchivedKeyword::IsTrusted => Ok(ISTRUSTED as u32),
|
||||
ArchivedKeyword::MailFlagBit0 => Ok(MAILFLAGBIT0 as u32),
|
||||
ArchivedKeyword::MailFlagBit1 => Ok(MAILFLAGBIT1 as u32),
|
||||
ArchivedKeyword::MailFlagBit2 => Ok(MAILFLAGBIT2 as u32),
|
||||
ArchivedKeyword::MaskedEmail => Ok(MASKEDEMAIL as u32),
|
||||
ArchivedKeyword::Memo => Ok(MEMO as u32),
|
||||
ArchivedKeyword::Muted => Ok(MUTED as u32),
|
||||
ArchivedKeyword::New => Ok(NEW as u32),
|
||||
ArchivedKeyword::Notify => Ok(NOTIFY as u32),
|
||||
ArchivedKeyword::Unsubscribed => Ok(UNSUBSCRIBED as u32),
|
||||
ArchivedKeyword::Other(string) => Err(string.as_ref()),
|
||||
}
|
||||
}
|
||||
@@ -274,6 +461,23 @@ impl ArchivedKeyword {
|
||||
ArchivedKeyword::Deleted => Keyword::Deleted,
|
||||
ArchivedKeyword::Forwarded => Keyword::Forwarded,
|
||||
ArchivedKeyword::MdnSent => Keyword::MdnSent,
|
||||
ArchivedKeyword::Autosent => Keyword::Autosent,
|
||||
ArchivedKeyword::CanUnsubscribe => Keyword::CanUnsubscribe,
|
||||
ArchivedKeyword::Followed => Keyword::Followed,
|
||||
ArchivedKeyword::HasAttachment => Keyword::HasAttachment,
|
||||
ArchivedKeyword::HasMemo => Keyword::HasMemo,
|
||||
ArchivedKeyword::HasNoAttachment => Keyword::HasNoAttachment,
|
||||
ArchivedKeyword::Imported => Keyword::Imported,
|
||||
ArchivedKeyword::IsTrusted => Keyword::IsTrusted,
|
||||
ArchivedKeyword::MailFlagBit0 => Keyword::MailFlagBit0,
|
||||
ArchivedKeyword::MailFlagBit1 => Keyword::MailFlagBit1,
|
||||
ArchivedKeyword::MailFlagBit2 => Keyword::MailFlagBit2,
|
||||
ArchivedKeyword::MaskedEmail => Keyword::MaskedEmail,
|
||||
ArchivedKeyword::Memo => Keyword::Memo,
|
||||
ArchivedKeyword::Muted => Keyword::Muted,
|
||||
ArchivedKeyword::New => Keyword::New,
|
||||
ArchivedKeyword::Notify => Keyword::Notify,
|
||||
ArchivedKeyword::Unsubscribed => Keyword::Unsubscribed,
|
||||
ArchivedKeyword::Other(other) => Keyword::Other(other.as_ref().into()),
|
||||
}
|
||||
}
|
||||
@@ -294,6 +498,23 @@ impl From<&ArchivedKeyword> for Keyword {
|
||||
ArchivedKeyword::Deleted => Keyword::Deleted,
|
||||
ArchivedKeyword::Forwarded => Keyword::Forwarded,
|
||||
ArchivedKeyword::MdnSent => Keyword::MdnSent,
|
||||
ArchivedKeyword::Autosent => Keyword::Autosent,
|
||||
ArchivedKeyword::CanUnsubscribe => Keyword::CanUnsubscribe,
|
||||
ArchivedKeyword::Followed => Keyword::Followed,
|
||||
ArchivedKeyword::HasAttachment => Keyword::HasAttachment,
|
||||
ArchivedKeyword::HasMemo => Keyword::HasMemo,
|
||||
ArchivedKeyword::HasNoAttachment => Keyword::HasNoAttachment,
|
||||
ArchivedKeyword::Imported => Keyword::Imported,
|
||||
ArchivedKeyword::IsTrusted => Keyword::IsTrusted,
|
||||
ArchivedKeyword::MailFlagBit0 => Keyword::MailFlagBit0,
|
||||
ArchivedKeyword::MailFlagBit1 => Keyword::MailFlagBit1,
|
||||
ArchivedKeyword::MailFlagBit2 => Keyword::MailFlagBit2,
|
||||
ArchivedKeyword::MaskedEmail => Keyword::MaskedEmail,
|
||||
ArchivedKeyword::Memo => Keyword::Memo,
|
||||
ArchivedKeyword::Muted => Keyword::Muted,
|
||||
ArchivedKeyword::New => Keyword::New,
|
||||
ArchivedKeyword::Notify => Keyword::Notify,
|
||||
ArchivedKeyword::Unsubscribed => Keyword::Unsubscribed,
|
||||
ArchivedKeyword::Other(string) => Keyword::Other(string.as_ref().into()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ pub enum SpecialUse {
|
||||
Shared,
|
||||
Important,
|
||||
None,
|
||||
Memos,
|
||||
Scheduled,
|
||||
Snoozed,
|
||||
}
|
||||
|
||||
impl SpecialUse {
|
||||
@@ -44,6 +47,9 @@ impl SpecialUse {
|
||||
b"sent" => SpecialUse::Sent,
|
||||
b"shared" => SpecialUse::Shared,
|
||||
b"important" => SpecialUse::Important,
|
||||
b"memos" => SpecialUse::Memos,
|
||||
b"scheduled" => SpecialUse::Scheduled,
|
||||
b"snoozed" => SpecialUse::Snoozed,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -57,6 +63,9 @@ impl SpecialUse {
|
||||
SpecialUse::Sent => Some("sent"),
|
||||
SpecialUse::Shared => Some("shared"),
|
||||
SpecialUse::Important => Some("important"),
|
||||
SpecialUse::Memos => Some("memos"),
|
||||
SpecialUse::Scheduled => Some("scheduled"),
|
||||
SpecialUse::Snoozed => Some("snoozed"),
|
||||
SpecialUse::None => None,
|
||||
}
|
||||
}
|
||||
@@ -73,6 +82,9 @@ impl ArchivedSpecialUse {
|
||||
ArchivedSpecialUse::Sent => Some("sent"),
|
||||
ArchivedSpecialUse::Shared => Some("shared"),
|
||||
ArchivedSpecialUse::Important => Some("important"),
|
||||
ArchivedSpecialUse::Memos => Some("memos"),
|
||||
ArchivedSpecialUse::Scheduled => Some("scheduled"),
|
||||
ArchivedSpecialUse::Snoozed => Some("snoozed"),
|
||||
ArchivedSpecialUse::None => None,
|
||||
}
|
||||
}
|
||||
@@ -89,6 +101,9 @@ impl From<&ArchivedSpecialUse> for SpecialUse {
|
||||
ArchivedSpecialUse::Sent => SpecialUse::Sent,
|
||||
ArchivedSpecialUse::Shared => SpecialUse::Shared,
|
||||
ArchivedSpecialUse::Important => SpecialUse::Important,
|
||||
ArchivedSpecialUse::Memos => SpecialUse::Memos,
|
||||
ArchivedSpecialUse::Scheduled => SpecialUse::Scheduled,
|
||||
ArchivedSpecialUse::Snoozed => SpecialUse::Snoozed,
|
||||
ArchivedSpecialUse::None => SpecialUse::None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user