| 1 | use superrust-analyzer cargo svg 0.18.0 node/element/path/::Parametersrust-analyzer cargo svg 0.18.0 node/element/path/parameters/Parameters#; |
| 2 | use superrust-analyzer cargo svg 0.18.0 node/element/path/::Positionrust-analyzer cargo svg 0.18.0 node/element/path/Position#; |
| 3 | |
| 4 | /// A command of a data attribute. |
| 5 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 6 | pub enum Commandrust-analyzer cargo svg 0.18.0 node/element/path/command/Command# { |
| 7 | /// [Establish][1] a new current point. |
| 8 | /// |
| 9 | /// [1]: https://www.w3.org/TR/SVG/paths.html#PathDataMovetoCommands |
| 10 | Moverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#Move#(Positionrust-analyzer cargo svg 0.18.0 node/element/path/Position#, Parametersrust-analyzer cargo svg 0.18.0 node/element/path/parameters/Parameters#), |
| 11 | |
| 12 | /// [Draw][1] straight lines. |
| 13 | /// |
| 14 | /// [1]: https://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands |
| 15 | Linerust-analyzer cargo svg 0.18.0 node/element/path/command/Command#Line#(Positionrust-analyzer cargo svg 0.18.0 node/element/path/Position#, Parametersrust-analyzer cargo svg 0.18.0 node/element/path/parameters/Parameters#), |
| 16 | |
| 17 | /// [Draw][1] horizontal lines. |
| 18 | /// |
| 19 | /// [1]: https://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands |
| 20 | HorizontalLinerust-analyzer cargo svg 0.18.0 node/element/path/command/Command#HorizontalLine#(Positionrust-analyzer cargo svg 0.18.0 node/element/path/Position#, Parametersrust-analyzer cargo svg 0.18.0 node/element/path/parameters/Parameters#), |
| 21 | |
| 22 | /// [Draw][1] vertical lines. |
| 23 | /// |
| 24 | /// [1]: https://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands |
| 25 | VerticalLinerust-analyzer cargo svg 0.18.0 node/element/path/command/Command#VerticalLine#(Positionrust-analyzer cargo svg 0.18.0 node/element/path/Position#, Parametersrust-analyzer cargo svg 0.18.0 node/element/path/parameters/Parameters#), |
| 26 | |
| 27 | /// [Draw][1] a quadratic Bézier curve. |
| 28 | /// |
| 29 | /// [1]: https://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands |
| 30 | QuadraticCurverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#QuadraticCurve#(Positionrust-analyzer cargo svg 0.18.0 node/element/path/Position#, Parametersrust-analyzer cargo svg 0.18.0 node/element/path/parameters/Parameters#), |
| 31 | |
| 32 | /// [Draw][1] a quadratic Bézier curve assuming the control point to be the |
| 33 | /// reflection of the control point on the previous command relative to the |
| 34 | /// current point. |
| 35 | /// |
| 36 | /// [1]: https://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands |
| 37 | SmoothQuadraticCurverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#SmoothQuadraticCurve#(Positionrust-analyzer cargo svg 0.18.0 node/element/path/Position#, Parametersrust-analyzer cargo svg 0.18.0 node/element/path/parameters/Parameters#), |
| 38 | |
| 39 | /// [Draw][1] a cubic Bézier curve. |
| 40 | /// |
| 41 | /// [1]: https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands |
| 42 | CubicCurverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#CubicCurve#(Positionrust-analyzer cargo svg 0.18.0 node/element/path/Position#, Parametersrust-analyzer cargo svg 0.18.0 node/element/path/parameters/Parameters#), |
| 43 | |
| 44 | /// [Draw][1] a cubic Bézier curve assuming the first control point to be |
| 45 | /// the reflection of the second control point on the previous command |
| 46 | /// relative to the current point. |
| 47 | /// |
| 48 | /// [1]: https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands |
| 49 | SmoothCubicCurverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#SmoothCubicCurve#(Positionrust-analyzer cargo svg 0.18.0 node/element/path/Position#, Parametersrust-analyzer cargo svg 0.18.0 node/element/path/parameters/Parameters#), |
| 50 | |
| 51 | /// [Draw][1] an elliptical arc. |
| 52 | /// |
| 53 | /// [1]: https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands |
| 54 | EllipticalArcrust-analyzer cargo svg 0.18.0 node/element/path/command/Command#EllipticalArc#(Positionrust-analyzer cargo svg 0.18.0 node/element/path/Position#, Parametersrust-analyzer cargo svg 0.18.0 node/element/path/parameters/Parameters#), |
| 55 | |
| 56 | /// [End][1] the current subpath. |
| 57 | /// |
| 58 | /// [1]: https://www.w3.org/TR/SVG/paths.html#PathDataClosePathCommand |
| 59 | Closerust-analyzer cargo svg 0.18.0 node/element/path/command/Command#Close#, |
| 60 | } |
| 61 | |
| 62 | macro_rules! implementrust-analyzer cargo svg 0.18.0 node/element/path/command/implement! { |
| 63 | ($($command:ident($position:ident) => $letter:expr,)*) => ( |
| 64 | impl From<Command> for String { |
| 65 | fn from(command: Command) -> Self { |
| 66 | use self::Command::*; |
| 67 | use super::Position::*; |
| 68 | match command { |
| 69 | $($command($position, parameters) => { |
| 70 | format!(concat!($letter, "{}"), String::from(parameters)) |
| 71 | })* |
| 72 | Close => String::from("z"), |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | ); |
| 77 | } |
| 78 | |
| 79 | implementrust-analyzer cargo svg 0.18.0 node/element/path/command/implement!! { |
| 80 | Moverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#Move#(Absoluterust-analyzer cargo svg 0.18.0 node/element/path/Position#Absolute#) => "M", |
| 81 | Moverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#Move#(Relativerust-analyzer cargo svg 0.18.0 node/element/path/Position#Relative#) => "m", |
| 82 | Linerust-analyzer cargo svg 0.18.0 node/element/path/command/Command#Line#(Absoluterust-analyzer cargo svg 0.18.0 node/element/path/Position#Absolute#) => "L", |
| 83 | Linerust-analyzer cargo svg 0.18.0 node/element/path/command/Command#Line#(Relativerust-analyzer cargo svg 0.18.0 node/element/path/Position#Relative#) => "l", |
| 84 | HorizontalLinerust-analyzer cargo svg 0.18.0 node/element/path/command/Command#HorizontalLine#(Absoluterust-analyzer cargo svg 0.18.0 node/element/path/Position#Absolute#) => "H", |
| 85 | HorizontalLinerust-analyzer cargo svg 0.18.0 node/element/path/command/Command#HorizontalLine#(Relativerust-analyzer cargo svg 0.18.0 node/element/path/Position#Relative#) => "h", |
| 86 | VerticalLinerust-analyzer cargo svg 0.18.0 node/element/path/command/Command#VerticalLine#(Absoluterust-analyzer cargo svg 0.18.0 node/element/path/Position#Absolute#) => "V", |
| 87 | VerticalLinerust-analyzer cargo svg 0.18.0 node/element/path/command/Command#VerticalLine#(Relativerust-analyzer cargo svg 0.18.0 node/element/path/Position#Relative#) => "v", |
| 88 | QuadraticCurverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#QuadraticCurve#(Absoluterust-analyzer cargo svg 0.18.0 node/element/path/Position#Absolute#) => "Q", |
| 89 | QuadraticCurverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#QuadraticCurve#(Relativerust-analyzer cargo svg 0.18.0 node/element/path/Position#Relative#) => "q", |
| 90 | SmoothQuadraticCurverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#SmoothQuadraticCurve#(Absoluterust-analyzer cargo svg 0.18.0 node/element/path/Position#Absolute#) => "T", |
| 91 | SmoothQuadraticCurverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#SmoothQuadraticCurve#(Relativerust-analyzer cargo svg 0.18.0 node/element/path/Position#Relative#) => "t", |
| 92 | CubicCurverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#CubicCurve#(Absoluterust-analyzer cargo svg 0.18.0 node/element/path/Position#Absolute#) => "C", |
| 93 | CubicCurverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#CubicCurve#(Relativerust-analyzer cargo svg 0.18.0 node/element/path/Position#Relative#) => "c", |
| 94 | SmoothCubicCurverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#SmoothCubicCurve#(Absoluterust-analyzer cargo svg 0.18.0 node/element/path/Position#Absolute#) => "S", |
| 95 | SmoothCubicCurverust-analyzer cargo svg 0.18.0 node/element/path/command/Command#SmoothCubicCurve#(Relativerust-analyzer cargo svg 0.18.0 node/element/path/Position#Relative#) => "s", |
| 96 | EllipticalArcrust-analyzer cargo svg 0.18.0 node/element/path/command/Command#EllipticalArc#(Absoluterust-analyzer cargo svg 0.18.0 node/element/path/Position#Absolute#) => "A", |
| 97 | EllipticalArcrust-analyzer cargo svg 0.18.0 node/element/path/command/Command#EllipticalArc#(Relativerust-analyzer cargo svg 0.18.0 node/element/path/Position#Relative#) => "a", |
| 98 | } |