Skip to main content

reddb_server/storage/queue/
mode.rs

1#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
2pub enum QueueMode {
3    Fanout,
4    #[default]
5    Work,
6}
7
8impl QueueMode {
9    pub fn as_str(self) -> &'static str {
10        match self {
11            Self::Fanout => "fanout",
12            Self::Work => "work",
13        }
14    }
15
16    pub fn parse(value: &str) -> Option<Self> {
17        match value.to_ascii_uppercase().as_str() {
18            "FANOUT" => Some(Self::Fanout),
19            "WORK" => Some(Self::Work),
20            _ => None,
21        }
22    }
23}