Crate svgdom [] [src]

This library is designed to represent SVG data as a tree structure.

Here is simple overview of such structure:

The Document itself is just a container of Nodes. You can create new Nodes only through the Document. Parsing and generating of the SVG data also done through it.

The Node represents any kind of an XML node. It can be an element, a comment, a text, etc. There are no different structs for each type.

The TagName represents a tag name of the element node. It's an enum of ElementId and String types. The ElementId contains all possible SVG element names and String used for non-SVG elements. Such separation used for performance reasons.

The Attributes container wraps a Vec of Attribute's.

At last, the id attribute is stored as a separate value and not as part of the Attributes.

Macros

assert_eq_text

Structs

Ancestors

An iterator of nodes to the ancestors a given node.

AspectRatio

Representation of the preserveAspectRatio attribute.

Attribute

Representation of the SVG attribute object.

Attributes

An attributes list.

Children

An iterator of nodes to the children of a given node.

Color

Representation of the <color> type.

Descendants

An iterator of nodes to a given node and its descendants, in tree order.

DisplaySvg

A wrapper to use fmt::Display with WriteOptions.

Document

Container of Nodes.

FollowingSiblings

An iterator of nodes to the siblings after a given node.

Length

Representation of the <length> type.

LengthList

Representation of the <list-of-length> type.

NodeData

Node's data.

NumberList

Representation of the <list-of-numbers> type.

ParseOptions

Options that defines SVG parsing.

Path

Representation of the SVG path data.

PathBuilder

A builder for Path.

Points

Representation of the <list-of-points> type.

PrecedingSiblings

An iterator of nodes to the siblings before a given node.

ReverseChildren

An iterator of nodes to the children of a given node, in reverse order.

ReverseTraverse

An iterator of nodes to a given node and its descendants, in reverse tree order.

StrSpan

An immutable string slice.

Transform

Representation of the <transform> type.

Traverse

An iterator of nodes to a given node and its descendants, in tree order.

ValueWriteOptions

Options for SVG types writing.

ViewBox

Representation of the <viewBox> type.

WriteOptions

Options that defines SVG writing.

Enums

Align

Representation of the align value of the preserveAspectRatio attribute.

AttributeId

List of all SVG attributes.

AttributeValue

Value of the SVG attribute.

AttributesOrder

An attributes order.

ElementId

List of all SVG elements.

Error

SVG DOM errors.

Indent

XML node indention

LengthUnit

List of all SVG length units.

ListSeparator

A separator type for a list of values.

NodeEdge

A node type during traverse.

NodeType

List of supported node types.

PaintFallback

Representation of the fallback part of the <paint> type.

PathCommand

List of all path commands.

PathSegment

Representation of the path segment.

QName

Qualified name.

QNameRef

Qualified name reference.

Traits

AttributeType

This trait contains methods that check attribute's type according to the SVG spec.

ElementType

This trait contains methods that check element's type according to the SVG spec.

FilterSvg

An iterator over SVG elements.

FilterSvgAttrs

An iterator over SVG attributes.

FilterSvgAttrsMut

An iterator over SVG attributes.

FromSpan

A trait for parsing data from a string.

FuzzyEq

A trait for fuzzy/approximate equality comparisons.

FuzzyZero

A trait for fuzzy/approximate comparisons of f64 numbers.

SvgId

A trait for SVG id's.

ValueWriteBuffer

A trait for writing data to the buffer.

WriteBuffer

A trait for writing data to the buffer.

Type Definitions

AttributeQName

Type alias for QName<AttributeId>.

AttributeQNameRef

Type alias for QNameRef<AttributeId>.

Node

Representation of the SVG node.

TagName

Type alias for QName<ElementId>.

TagNameRef

Type alias for QNameRef<ElementId>.