Crate svgmacro [−] [src]
Introduction to svgmacro
A macro for writing SVGs from Rust. Can write any valid XML-element. Handle variables and returning functions by wrapping them in a {} closure. Expressions begin with a @-symbol, such as if statements, for-loops or void-functions.
Examples
use std::fmt::Write; let mut out = String::new(); let width = 320; SVG!(&mut out, svg (xmlns="http://www.w3.org/2000/svg" width={width} height="200") [ g [ g (id="paragraph_1" fill="white")[text["This is an example"]] circle(cx="10" cy="10" r="10") @ for i in 0..3 { // Need to return to the SVG! macro SVG!(&mut out, circle(cx="10" cy="10" r="10") ); }; ] ] );
Macros
SVG | |
_parse_args |