svg_path/transform/parse
SVG transform attribute parser.
This module parses SVG transform lists such as
translate(10 20)rotate(30)scale(2). Commas are accepted where SVG allows
separators, and adjacent signed numbers such as translate(10-20) are
handled.
Types
Errors returned while parsing an SVG transform attribute.
pub type Error {
ExpectedClose
ExpectedOpen
ExpectedTransform
InvalidArgumentCount(String, Int)
InvalidNumber(String)
UnexpectedToken(String)
UnknownTransform(String)
}
Constructors
-
ExpectedCloseA closing parenthesis was expected.
-
ExpectedOpenAn opening parenthesis was expected.
-
ExpectedTransformA transform function name was expected.
-
InvalidArgumentCount(String, Int)A transform function received the wrong number of arguments.
-
InvalidNumber(String)A numeric token could not be parsed as a float.
-
UnexpectedToken(String)A token appeared where it is not valid.
-
UnknownTransform(String)The transform function is not part of SVG’s supported transform set.
Values
pub fn attribute(
input: String,
) -> Result(transform.Matrix, Error)
Parse an SVG transform attribute into a matrix.
Empty strings parse as the identity matrix.