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

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.

Error

The Error type.

ErrorPos

Position of the error.

Length

Representation of the <length> type.

LinkedNodes

An iterator over linked nodes.

Node

Representation of the SVG node.

Parents

An iterator of Nodes to the parents of a given node.

ParseOptions

Options that defines SVG parsing.

Transform

Representation of the <transform> type.

Traverse

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

WriteOptions

Options that defines SVG writing.

Enums

AttributeId

List of all SVG attributes.

AttributeValue

Value of the SVG attribute.

AttributesOrder

An attributes order.

ElementId

List of all SVG elements.

ErrorKind

The kind of an error.

Indent

XML node indention

LengthUnit

List of all SVG length units.

ListSeparator

A separator type for a list of values.

Name

A container for an SVG item name.

NameRef

A reference-like container for a Name object.

NodeEdge

Node type during traverse.

NodeType

List of supported node types.

ValueId

List of values for presentation attributes.

Traits

AttributeType

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

ChainedErrorExt

ChainedError additional methods.

ElementType

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

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.

Functions

write_dom

Writes a document into the buffer.

Type Definitions

AttributeName

Type alias for Name<AttributeId>.

AttributeNameRef

Type alias for NameRef<AttributeId>.

LengthList

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

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 Name<ElementId>.

TagNameRef

Type alias for NameRef<ElementId>.