Merge pull request #901 from hecrj/feature/default-rule-style

Implement `Default` for `Style` in `rule`
This commit is contained in:
Héctor Ramón 2021-06-01 18:54:08 +07:00 committed by GitHub
commit a9eb591628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -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()
}
}