# SVG_ICON
use `nom` to parse svg tag or file
## Example
```html
```
```rust
// parse from file path
let svg1 = Svg::from_path("E:/Rust/try/makepad/Gen-UI/gen/middleware/svg_icon/a.svg").unwrap();
// parse from str
let svg_str = r#""#;
let svg2: Svg = svg_str.parse().unwrap();
// use macro
let svg = svg!{
r##""##
};
```
### Result
```rust
svg = Svg {
header: Some(
Header {
version: Some(
"1.0",
),
encoding: Some(
UTF8,
),
},
),
x: None,
y: None,
height: Auto(
Some(
24.0,
),
),
width: Auto(
Some(
24.0,
),
),
view_box: Some(
(
0,
0,
48,
48,
),
),
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
children: [
Path(
Path {
common: CommonKVs {
x: None,
y: None,
fill: None,
stroke: Some(
"#008000",
),
stroke_width: Some(
4.0,
),
stroke_linecap: Some(
Round,
),
stroke_linejoin: Some(
Round,
),
stroke_dasharray: None,
stroke_dashoffset: None,
stroke_opacity: None,
stroke_miterlimit: None,
},
d: Some(
MoveTo(
M {
x: 24.0,
y: 19.0,
relative: false,
},
),
),
},
),
Path(
Path {
common: CommonKVs {
x: None,
y: None,
fill: None,
stroke: Some(
"#008000",
),
stroke_width: Some(
4.0,
),
stroke_linecap: Some(
Round,
),
stroke_linejoin: Some(
Round,
),
stroke_dasharray: None,
stroke_dashoffset: None,
stroke_opacity: None,
stroke_miterlimit: None,
},
d: Some(
MoveTo(
M {
x: 12.0,
y: 22.0,
relative: false,
},
),
),
},
),
Path(
Path {
common: CommonKVs {
x: None,
y: None,
fill: None,
stroke: Some(
"#008000",
),
stroke_width: Some(
4.0,
),
stroke_linecap: Some(
Round,
),
stroke_linejoin: Some(
Round,
),
stroke_dasharray: None,
stroke_dashoffset: None,
stroke_opacity: None,
stroke_miterlimit: None,
},
d: Some(
MoveTo(
M {
x: 28.0,
y: 30.0,
relative: false,
},
),
),
},
),
Path(
Path {
common: CommonKVs {
x: None,
y: None,
fill: None,
stroke: Some(
"#008000",
),
stroke_width: Some(
4.0,
),
stroke_linecap: Some(
Round,
),
stroke_linejoin: Some(
Round,
),
stroke_dasharray: None,
stroke_dashoffset: None,
stroke_opacity: None,
stroke_miterlimit: None,
},
d: Some(
MoveTo(
M {
x: 44.0,
y: 30.0,
relative: false,
},
),
),
},
),
Path(
Path {
common: CommonKVs {
x: None,
y: None,
fill: None,
stroke: Some(
"#008000",
),
stroke_width: Some(
4.0,
),
stroke_linecap: Some(
Round,
),
stroke_linejoin: Some(
Round,
),
stroke_dasharray: None,
stroke_dashoffset: None,
stroke_opacity: None,
stroke_miterlimit: None,
},
d: Some(
MoveTo(
M {
x: 20.0,
y: 36.0,
relative: false,
},
),
),
},
),
Path(
Path {
common: CommonKVs {
x: None,
y: None,
fill: None,
stroke: Some(
"#008000",
),
stroke_width: Some(
4.0,
),
stroke_linecap: Some(
Round,
),
stroke_linejoin: Some(
Round,
),
stroke_dasharray: None,
stroke_dashoffset: None,
stroke_opacity: None,
stroke_miterlimit: None,
},
d: Some(
MoveTo(
M {
x: 4.0,
y: 36.0,
relative: false,
},
),
),
},
),
Path(
Path {
common: CommonKVs {
x: None,
y: None,
fill: Some(
"#008000",
),
stroke: Some(
"#008000",
),
stroke_width: Some(
4.0,
),
stroke_linecap: Some(
Round,
),
stroke_linejoin: Some(
Round,
),
stroke_dasharray: None,
stroke_dashoffset: None,
stroke_opacity: None,
stroke_miterlimit: None,
},
d: Some(
MoveTo(
M {
x: 12.0,
y: 44.0,
relative: false,
},
),
),
},
),
Path(
Path {
common: CommonKVs {
x: None,
y: None,
fill: Some(
"#008000",
),
stroke: Some(
"#008000",
),
stroke_width: Some(
4.0,
),
stroke_linecap: Some(
Round,
),
stroke_linejoin: Some(
Round,
),
stroke_dasharray: None,
stroke_dashoffset: None,
stroke_opacity: None,
stroke_miterlimit: None,
},
d: Some(
MoveTo(
M {
x: 36.0,
y: 38.0,
relative: false,
},
),
),
},
),
],
}
```