reda_lib/model/
cell.rs

1use reda_lib_macro::model;
2use crate::model::LibPin;
3
4#[model]
5#[derive(Debug, PartialEq, Clone, Default)]
6pub struct LibCell {
7    pub name: String,
8    pub pins: Vec<LibPin>,
9}
10
11impl LibCell {
12    pub fn new<S: Into<String>>(name: S) -> Self {
13        Self { 
14            name: name.into(),
15            ..Default::default()
16        }
17    }
18
19    pub fn pin(&self, name: &str) -> Option<&LibPin> {
20        self.pins.iter().find(|p| p.name == name)
21    }
22}