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.

Modules

path

This module contains all struct's for manipulating SVG path data.

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.

Document

Container of Nodes.

FollowingSiblings

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

Length

Representation of the <length> type.

NodeData

Node's data.

ParseOptions

Options that defines SVG parsing.

Points

Representation of the SVG points attribute data.

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.

Transform

Representation of the <transform> type.

Traverse

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

ViewBox

ViewBox representation.

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.

QName

Qualified name.

QNameRef

Qualified name reference.

ValueId

List of values for presentation attributes.

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.

FuzzyEq

The trait for comparing f64 numbers.

FuzzyOrd

The trait for Ordering f64 numbers.

ParseFromSpan

A trait for parsing data from a string.

SvgId

A trait for SVG id's.

ToStringWithOptions

A trait for converting a value to a String with WriteOptions.

WriteBuffer

A trait for writing a data to the buffer.

Type Definitions

AttributeQName

Type alias for QName<AttributeId>.

AttributeQNameRef

Type alias for QNameRef<AttributeId>.

LengthList

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

Node

Representation of the SVG node.

NumberList

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

SvgAttrFilter

Filter iterator over SVG attributes.

SvgAttrFilterMut

Mutable filter iterator over SVG attributes.

TagName

Type alias for QName<ElementId>.

TagNameRef

Type alias for QNameRef<ElementId>.