diff --git a/src/fill.rs b/src/fill.rs index 9f1a3d1..c624705 100644 --- a/src/fill.rs +++ b/src/fill.rs @@ -147,14 +147,3 @@ impl Fill { } } -impl RenderCSS for Option { - fn render_fill_css(&self, colormap: &ColorMapping) -> String { - self.map(|fill| fill.render_fill_css(colormap)) - .unwrap_or_default() - } - - fn render_stroke_css(&self, colormap: &ColorMapping) -> String { - self.map(|fill| fill.render_stroke_css(colormap)) - .unwrap_or_default() - } -} diff --git a/src/objects.rs b/src/objects.rs index f90a723..1a1a5fb 100644 --- a/src/objects.rs +++ b/src/objects.rs @@ -109,6 +109,20 @@ pub trait RenderCSS { } } +impl RenderCSS for Option { + fn render_fill_css(&self, colormap: &ColorMapping) -> String { + self.as_ref() + .map(|v| v.render_fill_css(colormap)) + .unwrap_or_default() + } + + fn render_stroke_css(&self, colormap: &ColorMapping) -> String { + self.as_ref() + .map(|v| v.render_stroke_css(colormap)) + .unwrap_or_default() + } +} + impl Object { pub fn translate(&mut self, dx: i32, dy: i32) { match self {