Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
put Config struct into own mod
Browse files Browse the repository at this point in the history
changes cause rustc ICE
propably related to: rust-lang/rust#90682
  • Loading branch information
Cielquan committed Dec 6, 2021
1 parent 7668128 commit c5a02e6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
27 changes: 2 additions & 25 deletions src-tauri/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,33 +1,10 @@
mod file;
pub mod setup;
pub mod types;
mod util;

use self::file::get_conf_file_path;

/// The user specific part of the confiuration.
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct User {
pub name: Option<String>,
}

/// The application specific part of the confiuration.
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Settings {
pub database_uri: Option<String>,
pub language: String,
pub log_level: String,
pub theme: String,
pub today_autoscroll_left_offset: i32,
pub year_change_scroll_begin: bool,
pub year_to_show: Option<i32>,
}

/// The configuration object.
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Config {
pub user: Option<User>,
pub settings: Settings,
}
pub use self::types::Config;

// NOTE: Change defaults also in frontend initial State
/// Default configuration of RUlaub as TOML string.
Expand Down
24 changes: 24 additions & 0 deletions src-tauri/src/config/types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/// The user specific part of the confiuration.
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct User {
pub name: Option<String>,
}

/// The application specific part of the confiuration.
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Settings {
pub database_uri: Option<String>,
pub language: String,
pub log_level: String,
pub theme: String,
pub today_autoscroll_left_offset: i32,
pub year_change_scroll_begin: bool,
pub year_to_show: Option<i32>,
}

/// The configuration object.
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Config {
pub user: Option<User>,
pub settings: Settings,
}

0 comments on commit c5a02e6

Please sign in to comment.