ferric_fred/
updates_filter.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3#[non_exhaustive]
4pub enum UpdatesFilter {
5 All,
7 Macro,
9 Regional,
11}
12
13impl UpdatesFilter {
14 pub fn query_code(self) -> &'static str {
16 match self {
17 Self::All => "all",
18 Self::Macro => "macro",
19 Self::Regional => "regional",
20 }
21 }
22}
23
24#[cfg(test)]
25mod tests {
26 use super::*;
27
28 #[test]
29 fn query_codes_match_fred() {
30 assert_eq!(UpdatesFilter::All.query_code(), "all");
31 assert_eq!(UpdatesFilter::Macro.query_code(), "macro");
32 assert_eq!(UpdatesFilter::Regional.query_code(), "regional");
33 }
34}