{"id":15374783,"url":"https://github.com/mondeja/svg-path-cst","last_synced_at":"2025-04-15T15:12:25.075Z","repository":{"id":204801535,"uuid":"712702751","full_name":"mondeja/svg-path-cst","owner":"mondeja","description":"Concrete Syntax Tree SVG paths parser for Rust","archived":false,"fork":false,"pushed_at":"2025-04-11T09:03:32.000Z","size":108,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T15:12:20.342Z","etag":null,"topics":["cst","parser","svg","svg-path"],"latest_commit_sha":null,"homepage":"https://docs.rs/svg-path-cst","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mondeja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-11-01T02:29:51.000Z","updated_at":"2025-04-11T09:03:34.000Z","dependencies_parsed_at":"2024-01-16T22:31:48.905Z","dependency_job_id":"43091c61-8ad0-47c4-80b1-1f506eee892a","html_url":"https://github.com/mondeja/svg-path-cst","commit_stats":null,"previous_names":["mondeja/svg-path-cst"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mondeja%2Fsvg-path-cst","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mondeja%2Fsvg-path-cst/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mondeja%2Fsvg-path-cst/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mondeja%2Fsvg-path-cst/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mondeja","download_url":"https://codeload.github.com/mondeja/svg-path-cst/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249094933,"owners_count":21211837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cst","parser","svg","svg-path"],"created_at":"2024-10-01T13:59:45.225Z","updated_at":"2025-04-15T15:12:25.053Z","avatar_url":"https://github.com/mondeja.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svg-path-cst\n\n[![Crates.io](https://img.shields.io/crates/v/svg-path-cst?logo=rust)](https://crates.io/crates/svg-path-cst)\n[![docs.rs](https://img.shields.io/docsrs/svg-path-cst?logo=docs.rs)](https://docs.rs/svg-path-cst)\n![Tests](https://img.shields.io/github/actions/workflow/status/mondeja/svg-path-cst/ci.yml?label=tests\u0026logo=github)\n[![License](https://img.shields.io/crates/l/svg-path-cst?logo=mit)](https://github.com/mondeja/svg-path-cst/blob/master/LICENSE.md)\n\nConcrete Syntax Tree parser for SVG v1.1 paths.\n\n## Install\n\n```sh\ncargo add svg-path-cst\n```\n\n## Usage\n\n```rust\nuse svg_path_cst::{\n    svg_path_cst,\n    SVGPathCSTNode,\n    SVGPathSegment,\n    SVGPathCommand,\n    WSP,\n    Sign,\n    SyntaxError,\n};\n\nlet cst: Result\u003cVec\u003cSVGPathCSTNode\u003e, SyntaxError\u003e = svg_path_cst(b\"m0 0 L1,-1\");\n\nlet expected_cst: Vec\u003cSVGPathCSTNode\u003e = vec![\n    SVGPathCSTNode::Segment(SVGPathSegment{\n        command: \u0026SVGPathCommand::MovetoLower,\n        args: vec![0.0, 0.0],\n        start: 0,\n        end: 4,\n        chained: false,\n        chain_start: 0,\n        chain_end: 4,\n        cst: vec![\n            SVGPathCSTNode::Command(\u0026SVGPathCommand::MovetoLower),\n            SVGPathCSTNode::Number{\n                raw_number: \"0\".to_string(),\n                value: 0.0,\n                start: 1,\n                end: 2,\n            },\n            SVGPathCSTNode::Whitespace{\n                wsp: \u0026WSP::Space,\n                start: 2,\n                end: 3,\n            },\n            SVGPathCSTNode::Number{\n                raw_number: \"0\".to_string(),\n                value: 0.0,\n                start: 3,\n                end: 4,\n            },\n        ],\n    }),\n    SVGPathCSTNode::Whitespace{\n        wsp: \u0026WSP::Space,\n        start: 4,\n        end: 5,\n    },\n    SVGPathCSTNode::Segment(SVGPathSegment{\n        command: \u0026SVGPathCommand::LinetoUpper,\n        args: vec![1.0, -1.0],\n        start: 5,\n        end: 10,\n        chained: false,\n        chain_start: 5,\n        chain_end: 10,\n        cst: vec![\n            SVGPathCSTNode::Command(\u0026SVGPathCommand::LinetoUpper),\n            SVGPathCSTNode::Number{\n                raw_number: \"1\".to_string(),\n                value: 1.0,\n                start: 6,\n                end: 7,\n            },\n            SVGPathCSTNode::Comma{ start: 7 },\n            SVGPathCSTNode::Sign{ sign: \u0026Sign::Minus, start: 8 },\n            SVGPathCSTNode::Number{\n                raw_number: \"1\".to_string(),\n                value: 1.0,\n                start: 9,\n                end: 10,\n            },\n        ],\n    }),\n];\n\nassert_eq!(cst, Ok(expected_cst));\n```\n\n## Compatibility\n\nThis crate is compatible with SVG v1.1 paths, as defined in the [W3C SVG 1.1]\nand [`no_std` environments].\n\nMinimum Supported Rust Version: 1.61.0\n\n## Features\n\n### **`tracing`**\n\nAdd [`tracing`] support. See the [`tracing` example] to learn how to use it.\n\n### **`strict`**\n\nEnable strict mode. The differences between strict and non-strict modes are:\n\n- With empty input (`b\"\"`), non-strict mode returns an empty vector, while\n  strict mode returns a `SyntaxError::UnexpectedEnding` error.\n- With the input `b\"none\"`, non-strict mode returns a `SVGPathCSTNode::None`\n  node, while strict mode returns a `SyntaxError::ExpectedMovetoCommand` error.\n  The `\"none\"` input is defined\n  [by the SVG specification](https://www.w3.org/TR/SVG/paths.html#TheDProperty).\n- With input containing only whitespaces, non-strict mode returns an empty vector,\n  while strict mode returns a `SyntaxError::ExpectedMovetoCommand` error.\n\n[W3C SVG 1.1]: https://www.w3.org/TR/SVG11/paths.html#PathData\n[`no_std` environments]: https://docs.rust-embedded.org/book/intro/no-std.html\n[`tracing`]: https://docs.rs/tracing/latest/tracing\n[`tracing` example]: https://github.com/mondeja/svg-path-cst/tree/master/examples/tracing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmondeja%2Fsvg-path-cst","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmondeja%2Fsvg-path-cst","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmondeja%2Fsvg-path-cst/lists"}