Function stringify

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

transform a Element(AST struct) to svg

return string.

ยงExample

use svg_simple_parser::{Element,stringify};
use std::collections::HashMap;

let root = Element::new_width_children((
  "rect",
  HashMap::from([
    ("width".to_owned(),"100"),
  ]),
  vec![
    Element::new_width_children((
      "rect",
      HashMap::from([
        ("width".to_owned(),"100"),
      ]),
      vec![],
    )),
  ],
));
let svg = stringify(root);
assert_eq!(svg,"<rect width=\"100\"><rect width=\"100\"/></rect>");