1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use serde::Deserialize;

/// Transport class for editing your profile
#[derive(Debug, Deserialize)]
pub struct ProfileForm {
  username: String,
  theme: String,
  navbar_color: String,
  link_color: String
}

impl ProfileForm {
  pub fn username(&self) -> &String {
    &self.username
  }

  pub fn theme(&self) -> rustimate_core::profile::Theme {
    match self.theme.parse::<rustimate_core::profile::Theme>() {
      Ok(t) => t,
      Err(_) => rustimate_core::profile::Theme::Light
    }
  }

  pub fn navbar_color(&self) -> &String {
    &self.navbar_color
  }

  pub fn link_color(&self) -> &String {
    &self.link_color
  }
}