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
use serde::Deserialize;

#[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) -> dbui_core::profile::Theme {
    self.theme.parse::<dbui_core::profile::Theme>().expect("Cannot parse theme")
  }

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

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