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); ```
| SVG Type | Rust Type | Storage | Parser |
| ------------------------- | ------------- | ------- | ------------------- |
| [\ None. This crate is a successor for the Licensed under either of at your option. 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.
FromStr
) and
to string traits (Display
, WriteBuffer
).paint
type can only be parsed.Benefits
M10-20A5.5.3-4 110-.1
will be parsed correctly.Limitations
 
or &data;
.<color>
followed by the <icccolor>
is not supported. As the <icccolor>
itself.fill="AppWorkspace"
,
are not supported. They were deprecated anyway.Safety
Alternatives
Migration from svgparser
svgparser
crate,
but it differs from it in many ways.
svgparser
this crate not only parse values but can also store and write them.
Currently, it has a minimal API for manipulating this values.AttributeValue
.
This crate provides only value parsers. You should match attributes and values by yourself.ValueId
.
It's up to you how to store those values.License
Contribution