Add Default trait to Settings
This commit is contained in:
parent
9cc1a52e5a
commit
22fbe5aba7
@ -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;
|
use std::str::FromStr;
|
||||||
impl FromStr for Settings {
|
impl FromStr for Settings {
|
||||||
type Err = serde_yaml::Error;
|
type Err = serde_yaml::Error;
|
||||||
|
Loading…
Reference in New Issue
Block a user