diff options
author | 2021-06-01 18:32:56 +0700 | |
---|---|---|
committer | 2021-06-01 18:32:56 +0700 | |
commit | 662889bb8355d9e388d5eda6c69bf065f156884a (patch) | |
tree | e4f32b5dbdff5fd556d21ca52d99f638df68957a /style | |
parent | e292821c3780fc5a57c835815efc7a232ce4dc32 (diff) | |
download | iced-662889bb8355d9e388d5eda6c69bf065f156884a.tar.gz iced-662889bb8355d9e388d5eda6c69bf065f156884a.tar.bz2 iced-662889bb8355d9e388d5eda6c69bf065f156884a.zip |
Implement `Default` for `Style` in `rule`
Diffstat (limited to 'style')
-rw-r--r-- | style/src/rule.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/style/src/rule.rs b/style/src/rule.rs index 5021340b..be4c86d1 100644 --- a/style/src/rule.rs +++ b/style/src/rule.rs @@ -79,6 +79,17 @@ pub struct Style { pub fill_mode: FillMode, } +impl std::default::Default for Style { + fn default() -> Self { + Style { + color: [0.6, 0.6, 0.6, 0.51].into(), + width: 1, + radius: 0.0, + fill_mode: FillMode::Percent(90.0), + } + } +} + /// A set of rules that dictate the style of a rule. pub trait StyleSheet { /// Produces the style of a rule. @@ -89,12 +100,7 @@ struct Default; impl StyleSheet for Default { fn style(&self) -> Style { - Style { - color: [0.6, 0.6, 0.6, 0.51].into(), - width: 1, - radius: 0.0, - fill_mode: FillMode::Percent(90.0), - } + Style::default() } } |