Function svg_simple_parser::stringify[][src]

pub fn stringify(ele: &Element<'_>) -> String
Expand description

transform a Element(AST struct) to svg

return string.

Example

use svg_simple_parser::{Element,stringify};

let root = Element{
  ele_type:"rect",
  attributes:std::collections::HashMap::from([
    ("width".to_owned(),"100"),
  ]),
  children:vec![
    Element{
      ele_type:"rect",
      attributes:std::collections::HashMap::from([
        ("width".to_owned(),"100"),
      ]),
      children:vec![],
    },
  ],
};
let svg = stringify(&root);
println!("{:#?}", svg);