svgtypes

Build Status Crates.io Documentation Rust 1.31+

svgtypes is a collection of parsers, containers and writers for SVG 1.1 types.

Usage is simple as:

```rust use svgtypes::Path;

let path: Path = "M10-20A5.5.3-4 110-.1".parse().unwrap(); asserteq!(path.tostring(), "M 10 -20 A 5.5 0.3 -4 1 1 0 -0.1"); ```

You can also use a low-level, pull-based parser:

```rust use svgtypes::PathParser;

let p = PathParser::from("M10-20A5.5.3-4 110-.1"); for token in p { println!("{:?}", token); } ```

You can also tweak an output format:

```rust use svgtypes::{Path, WriteBuffer, WriteOptions};

let pathstr = "M10-20A5.5.3-4 110-.1"; let path: Path = pathstr.parse().unwrap();

let opt = WriteOptions { removeleadingzero: true, usecompactpathnotation: true, joinarctoflags: true, .. WriteOptions::default() };

asserteq!(path.withwriteopt(&opt).tostring(), path_str); ```

Supported SVG types

| SVG Type | Rust Type | Storage | Parser | | ------------------------- | ------------- | ------- | ------------------- | | [\

Benefits

Limitations

Safety

Alternatives

None.

Migration from svgparser

This crate is a successor for the svgparser crate, but it differs from it in many ways.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.