figma_api/models/
measurement.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/// Measurement : A pinned distance between two nodes in Dev Mode
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Measurement {
17    #[serde(rename = "id")]
18    pub id: String,
19    #[serde(rename = "start")]
20    pub start: Box<models::MeasurementStartEnd>,
21    #[serde(rename = "end")]
22    pub end: Box<models::MeasurementStartEnd>,
23    #[serde(rename = "offset")]
24    pub offset: Box<models::MeasurementOffset>,
25    /// When manually overridden, the displayed value of the measurement
26    #[serde(rename = "freeText", skip_serializing_if = "Option::is_none")]
27    pub free_text: Option<String>,
28}
29
30impl Measurement {
31    /// A pinned distance between two nodes in Dev Mode
32    pub fn new(id: String, start: models::MeasurementStartEnd, end: models::MeasurementStartEnd, offset: models::MeasurementOffset) -> Measurement {
33        Measurement {
34            id,
35            start: Box::new(start),
36            end: Box::new(end),
37            offset: Box::new(offset),
38            free_text: None,
39        }
40    }
41}
42