figma_api/models/rectangle.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/// Rectangle : A rectangle that expresses a bounding box in absolute coordinates.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Rectangle {
17 /// X coordinate of top left corner of the rectangle.
18 #[serde(rename = "x")]
19 pub x: f64,
20 /// Y coordinate of top left corner of the rectangle.
21 #[serde(rename = "y")]
22 pub y: f64,
23 /// Width of the rectangle.
24 #[serde(rename = "width")]
25 pub width: f64,
26 /// Height of the rectangle.
27 #[serde(rename = "height")]
28 pub height: f64,
29}
30
31impl Rectangle {
32 /// A rectangle that expresses a bounding box in absolute coordinates.
33 pub fn new(x: f64, y: f64, width: f64, height: f64) -> Rectangle {
34 Rectangle {
35 x,
36 y,
37 width,
38 height,
39 }
40 }
41}
42