rm_config/main_config/
mod.rs1mod connection;
2mod general;
3mod icons;
4mod search_tab;
5mod torrents_tab;
6
7pub use connection::Connection;
8pub use general::General;
9pub use icons::Icons;
10use intuitils::config::IntuiConfig;
11pub use search_tab::SearchTab;
12pub use torrents_tab::TorrentsTab;
13
14use serde::Deserialize;
15
16#[derive(Deserialize)]
17pub struct MainConfig {
18 #[serde(default)]
19 pub general: General,
20 pub connection: Connection,
21 #[serde(default)]
22 pub torrents_tab: TorrentsTab,
23 #[serde(default)]
24 pub search_tab: SearchTab,
25 #[serde(default)]
26 pub icons: Icons,
27}
28
29impl IntuiConfig for MainConfig {
30 fn app_name() -> &'static str {
31 "rustmission"
32 }
33
34 fn filename() -> &'static str {
35 "config.toml"
36 }
37
38 fn default_config() -> &'static str {
39 include_str!("../../defaults/config.toml")
40 }
41
42 fn should_exit_if_not_found() -> bool {
43 true
44 }
45
46 fn message_if_not_found() -> Option<String> {
47 Some(format!(
48 "Update {:?} (especially connection url) and start rustmission again",
49 Self::path()
50 ))
51 }
52}