1 |
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
2 |
use serde_json::Value;
|
3 |
|
4 |
pub trait Setting: Serialize + DeserializeOwned {
|
5 |
fn name() -> &'static str;
|
6 |
}
|
7 |
|
8 |
#[derive(Debug, Clone, Serialize, Deserialize)]
|
9 |
pub struct AnySetting(Value);
|
10 |
|
11 |
impl Setting for AnySetting {
|
12 |
fn name() -> &'static str {
|
13 |
"any"
|
14 |
}
|
15 |
}
|
16 |
|
17 |
#[derive(Debug, Serialize, Deserialize)]
|
18 |
pub struct UserBio(pub String);
|
19 |
|
20 |
impl Setting for UserBio {
|
21 |
fn name() -> &'static str {
|
22 |
"Bio"
|
23 |
}
|
24 |
}
|
25 |
|
26 |
#[derive(Debug, Serialize, Deserialize)]
|
27 |
pub struct UserDisplayName(pub String);
|
28 |
|
29 |
impl Setting for UserDisplayName {
|
30 |
fn name() -> &'static str {
|
31 |
"Display Name"
|
32 |
}
|
33 |
}
|
34 |
|
35 |
#[derive(Debug, Serialize, Deserialize)]
|
36 |
pub struct UserDisplayImage(pub String);
|
37 |
|
38 |
impl Setting for UserDisplayImage {
|
39 |
fn name() -> &'static str {
|
40 |
"Profile Image"
|
41 |
}
|
42 |
}
|
43 |
|