diff --git a/src/settings/mod.rs b/src/settings/mod.rs index edbf1fe..8767d27 100644 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs @@ -370,6 +370,28 @@ impl Settings { } } +impl Default for Settings { + /// Creates a new empty instance of [`Settings`] + /// + /// # Example + /// + /// ``` + /// let s = lang_evolve_core::settings::Settings::default(); + /// let content_yaml = r#"--- + /// version: "1" + /// categories: {} + /// rules: []"#; + /// let content_json = r#"{"version":"1","categories":{},"rules":[]}"#; + /// assert_eq!(content_yaml, serde_yaml::to_string(&s).unwrap()); + /// assert_eq!(content_json, serde_json::to_string(&s).unwrap()); + /// ``` + /// + /// [`Settings`]: ./settings/struct.Settings.html + fn default() -> Self { + Self::new() + } +} + use std::str::FromStr; impl FromStr for Settings { type Err = serde_yaml::Error;