Expand description

This module provides an easy and safe way to interact with attributes of Elements

Note

In the crate::prelude the name for Attribute is Attr and for AttributeValue is AttrValue

Examples

1) Setting attributes of a circle

use svg_definitions::prelude::*;

let circle = SVGElem::new(Tag::Circle)
    .set(Attr::Radius, 10.0)
    .set(Attr::Cx, 15)
    .set(Attr::Cy, 15)
    .set(Attr::StrokeWidth, 1)
    .set(Attr::Stroke, "#000")
    .set(Attr::Fill, "transparent");

2) Setting attributes of a triangle

use svg_definitions::prelude::*;

let triangle = SVGElem::new(Tag::Path)
    .set(Attr::StrokeWidth, 1)
    .set(Attr::Stroke, "#000")
    .set(Attr::Fill, "transparent")
    .set(Attr::D, PathData::new()
        .move_to((0.0, 0.0))
        .line_to((10.0, 0.0))
        .line_to((0.0, 10.0))
        .line_to((0.0, 0.0))
        .close_path()
    );

Enums

An attribute to an Element