postcrate_core/mailbox/
kinds.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6#[cfg_attr(feature = "specta", derive(specta::Type))]
7#[serde(rename_all = "lowercase")]
8pub enum MailboxKind {
9 Primary,
10 Shared,
11 Ephemeral,
12}
13
14impl MailboxKind {
15 pub fn as_str(self) -> &'static str {
16 match self {
17 MailboxKind::Primary => "primary",
18 MailboxKind::Shared => "shared",
19 MailboxKind::Ephemeral => "ephemeral",
20 }
21 }
22
23 pub fn from_str(s: &str) -> Option<Self> {
24 match s {
25 "primary" => Some(MailboxKind::Primary),
26 "shared" => Some(MailboxKind::Shared),
27 "ephemeral" => Some(MailboxKind::Ephemeral),
28 _ => None,
29 }
30 }
31}