pub struct Element { /* private fields */ }
Expand description

A pseudo-SVG Element

use railroad::notactuallysvg as svg;
let e = svg::Element::new("g")
        .add(svg::Element::new("rect")
                .set("class", "important")
                .set("x", 15))
        .add(svg::PathData::new(svg::HDir::LTR)
                 .move_to(5, 5)
                 .line_rel(10, 20)
                 .into_path());
let serialized = e.to_string();
assert_eq!(serialized, "<g>\n<rect class=\"important\" x=\"15\"/>\n<path d=\" M 5 5 l 10 20\"/>\n</g>\n");

Implementations

Construct a new Element of type name.

Set this Element’s attribute key to value

Set all attributes via these key:value-pairs

Set the text within the opening and closing tag of this Element.

The text is automatically HTML-escaped. It is written before any children.

Set the text within the opening and closing tag of this Element.

The text is NOT automatically HTML-escaped.

Add a child to this Element

Children is written within the opening and closing tag of this Element.

Add a child to this Element

Children is written within the opening and closing tag of this Element.

Add a sibling to this Element

Siblings is written after the closing tag of this Element.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.