You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// println!("The configuration is {:?}", config);
34
112
/// ```
35
-
#[derive(Serialize,Deserialize,Debug)]
113
+
#[derive(Serialize,Deserialize,Debug,Clone)]
36
114
pubstructConfig{
115
+
#[serde(skip_serializing_if = "Option::is_none")]
37
116
pubenable_nightly_info:Option<bool>,
117
+
#[serde(skip_serializing_if = "Option::is_none")]
38
118
pubenable_release_build:Option<bool>,
119
+
#[serde(skip_serializing_if = "Option::is_none")]
39
120
pubdownloads_location:Option<String>,
121
+
#[serde(skip_serializing_if = "Option::is_none")]
40
122
pubinstallation_location:Option<String>,
123
+
#[serde(skip_serializing_if = "Option::is_none")]
41
124
pubversion_sync_file_location:Option<String>,
125
+
#[serde(skip_serializing_if = "Option::is_none")]
42
126
pubgithub_mirror:Option<String>,
127
+
#[serde(skip_serializing_if = "Option::is_none")]
43
128
pubrollback_limit:Option<u8>,
44
-
}
45
-
46
-
/// Handles the application configuration.
47
-
///
48
-
/// This function reads the configuration file, which can be in either TOML or JSON format, and returns a `Config` object. If the configuration file does not exist, it returns a `Config` object with all fields set to `None`.
49
-
///
50
-
/// # Returns
51
-
///
52
-
/// * `Result<Config>` - Returns a `Result` that contains a `Config` object if the function completes successfully. If an error occurs, it returns `Err`.
53
-
///
54
-
/// # Example
55
-
///
56
-
/// ```rust
57
-
/// let config = handle_config().await.unwrap();
58
-
/// println!("The configuration is {:?}", config);
59
-
/// ```
60
-
pubasyncfnhandle_config() -> Result<Config>{
61
-
let config_file = crate::helpers::directories::get_config_file()?;
62
-
let config = match fs::read_to_string(&config_file).await{
0 commit comments