Skip to main content

reda_gds/models/
path.rs

1use derive_builder::Builder;
2
3use crate::GdsCoord;
4
5use super::GdsPathType;
6
7#[derive(Debug, Default, Clone, Builder)]
8#[builder(setter(strip_option, into))]
9pub struct GdsPath {
10    #[builder(default)]
11    pub elf_flags: Option<i16>,
12
13    #[builder(default)]
14    pub plex: Option<i32>,
15
16    pub layer: i16,
17    pub data_type: i16,
18
19    #[builder(default)]
20    pub path_type: GdsPathType,
21    #[builder(default)]
22    pub width: Option<i32>,
23
24    pub xy: Vec<GdsCoord>,
25    
26    #[builder(default)]
27    pub purpose_layer: Option<i16>,
28}
29
30impl GdsPath {
31    pub fn new(layer: i16, coords: impl Into<Vec<GdsCoord>>, width: i32) -> Self {
32        GdsPathBuilder::default()
33            .layer(layer)
34            .data_type(0i16)
35            .width(width)
36            .xy(coords)
37            .build()
38            .unwrap()
39    }
40}