ferric_fred/
sort_order.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4#[non_exhaustive]
5pub enum SortOrder {
6 Ascending,
8 Descending,
10}
11
12impl SortOrder {
13 pub fn query_code(self) -> &'static str {
15 match self {
16 Self::Ascending => "asc",
17 Self::Descending => "desc",
18 }
19 }
20}
21
22#[cfg(test)]
23mod tests {
24 use super::*;
25
26 #[test]
27 fn query_codes_match_fred() {
28 assert_eq!(SortOrder::Ascending.query_code(), "asc");
29 assert_eq!(SortOrder::Descending.query_code(), "desc");
30 }
31}