summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 2d40dd5..034990b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,6 +1,7 @@
#![allow(unused_braces)]
use crate::resp_types::RespLoginInfo;
+use serde_derive::Deserialize;
use std::borrow::Cow;
use std::collections::HashMap;
use std::sync::Arc;
@@ -11,6 +12,31 @@ mod resp_types;
mod routes;
mod util;
+#[derive(Deserialize, PartialEq, Clone, Copy)]
+#[serde(rename_all = "snake_case")]
+pub enum SortType {
+ Hot,
+ New,
+}
+
+impl SortType {
+ pub const VALUES: &'static [SortType] = &[SortType::Hot, SortType::New];
+
+ pub fn as_str(&self) -> &'static str {
+ match self {
+ SortType::Hot => "hot",
+ SortType::New => "new",
+ }
+ }
+
+ pub fn lang_key(&self) -> &'static str {
+ match self {
+ SortType::Hot => "sort_hot",
+ SortType::New => "sort_new",
+ }
+ }
+}
+
pub type HttpClient = hyper::Client<hyper_tls::HttpsConnector<hyper::client::HttpConnector>>;
pub struct RouteContext {