svg_path/parse
SVG path data parser.
This module parses the d attribute syntax used by SVG paths. It supports
comma and whitespace separators, compact signed numbers, relative commands,
implicit repeated commands, smooth curves, and arcs.
Types
Errors returned while parsing SVG path data.
pub type Error {
Core(svg_path.Error)
ExpectedArcFlag
ExpectedCommand
ExpectedMove
ExpectedNumber
InvalidNumber(String)
UnsupportedCommand(String)
}
Constructors
-
Core(svg_path.Error)A parsed path was internally invalid according to the core path model.
-
ExpectedArcFlagAn arc flag was not
0or1. -
ExpectedCommandA command letter was expected.
-
ExpectedMovePath data must begin with a move command.
-
ExpectedNumberA numeric argument was expected.
-
InvalidNumber(String)A numeric token could not be parsed as a float.
-
UnsupportedCommand(String)The command letter is not supported by this library.
Values
pub fn path(input: String) -> Result(svg_path.Path, Error)
Parse an SVG path data string into a Path.
Empty strings parse as an empty path. Move-only subpaths are preserved as empty subpaths with start points. Closepath commands mark subpaths as closed, inserting a straight line back to the subpath start when needed.