figma_api/models/path.rs
1/*
2 * Figma API
3 *
4 * This is the OpenAPI specification for the [Figma REST API](https://www.figma.com/developers/api). Note: we are releasing the OpenAPI specification as a beta given the large surface area and complexity of the REST API. If you notice any inaccuracies with the specification, please [file an issue](https://github.com/figma/rest-api-spec/issues).
5 *
6 * The version of the OpenAPI document: 0.31.0
7 * Contact: support@figma.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Path : Defines a single path
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Path {
17 /// A series of path commands that encodes how to draw the path.
18 #[serde(rename = "path")]
19 pub path: String,
20 /// The winding rule for the path (same as in SVGs). This determines whether a given point in space is inside or outside the path.
21 #[serde(rename = "windingRule")]
22 pub winding_rule: WindingRule,
23 /// If there is a per-region fill, this refers to an ID in the `fillOverrideTable`.
24 #[serde(rename = "overrideID", skip_serializing_if = "Option::is_none")]
25 pub override_id: Option<f64>,
26}
27
28impl Path {
29 /// Defines a single path
30 pub fn new(path: String, winding_rule: WindingRule) -> Path {
31 Path {
32 path,
33 winding_rule,
34 override_id: None,
35 }
36 }
37}
38/// The winding rule for the path (same as in SVGs). This determines whether a given point in space is inside or outside the path.
39#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
40pub enum WindingRule {
41 #[serde(rename = "NONZERO")]
42 Nonzero,
43 #[serde(rename = "EVENODD")]
44 Evenodd,
45}
46
47impl Default for WindingRule {
48 fn default() -> WindingRule {
49 Self::Nonzero
50 }
51}
52