1use crate::{SvgCircle, SvgGroup, SvgId, SvgPath, SvgRect, SvgScript, SvgStyle, SvgUse};
2use std::io::Write;
3
4pub enum SvgElement {
5 Rect(SvgRect),
6 Circle(SvgCircle),
7 Script(SvgScript),
8 Group(SvgGroup),
9 Path(SvgPath),
10 Style(SvgStyle),
11 Use(SvgUse),
12}
13
14impl SvgElement {
15 pub(crate) fn write<W: Write>(&self, id: Option<SvgId>, writer: &mut W) {
16 match self {
17 Self::Circle(circle) => {
18 circle.write(id, writer);
19 }
20 Self::Rect(rect) => {
21 rect.write(id, writer);
22 }
23 Self::Script(script) => {
24 script.write(id, writer);
25 }
26 Self::Group(group) => {
27 group.write(id, writer);
28 }
29 Self::Path(path) => {
30 path.write(id, writer);
31 }
32 Self::Style(style) => {
33 style.write(id, writer);
34 }
35 Self::Use(svg_use) => {
36 svg_use.write(id, writer);
37 }
38 }
39 }
40}