SvgDocDisplay

Trait SvgDocDisplay 

Source
pub trait SvgDocDisplay: DisplayShape {
    // Required method
    fn shape_style_els(&self) -> impl Iterator<Item = Element>;

    // Provided methods
    fn create_svg_doc(&self) -> Document { ... }
    fn shape_svg_els(&self) -> impl Iterator<Item = Element> { ... }
}
Expand description

For plotting different SVGs

Use this trait when you have a shape and you want to print or save an SVG for it. The create_svg_doc method returns an svg::Document for the shape.

Required Methods§

Source

fn shape_style_els(&self) -> impl Iterator<Item = Element>

Iterator through the style elements for the svg

Provided Methods§

Source

fn create_svg_doc(&self) -> Document

Create an SVG document for the shape

Source

fn shape_svg_els(&self) -> impl Iterator<Item = Element>

Iterator through all the components of the svg

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl SvgDocDisplay for ClockShape

SVG for an adic clock

let neg_one_fourth = radic!(5, [], [1]);
let num_digits = 6;
let adic_clock = ClockShape::new(&neg_one_fourth, num_digits, ClockShapeOptions::default())?;
let clock_svg = adic_clock.create_svg_doc();
Source§

impl SvgDocDisplay for TreeShape

SVG for an adic tree

let neg_one_fourth = radic!(5, [], [1]);
let num_digits = 6;
let adic_tree = TreeShape::full_tree(5, num_digits, TreeShapeOptions::default())?;
let tree_svg = adic_tree.create_svg_doc();
let adic_tree = TreeShape::adic_number_full_tree(&neg_one_fourth, num_digits, TreeShapeOptions::default())?;
let tree_svg = adic_tree.create_svg_doc();
let adic_tree = TreeShape::zoomed_tree(&neg_one_fourth, num_digits, TreeShapeOptions::default())?;
let tree_svg = adic_tree.create_svg_doc();