reda_lib/model/
library.rs

1use reda_lib_macro::model;
2use crate::model::LibCell;
3
4#[model]
5#[derive(Debug, PartialEq, Clone, Default)]
6pub struct LibLibrary {
7    pub name: String,
8    pub cells: Vec<LibCell>,
9}
10
11impl LibLibrary {
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 cell(&self, name: &str) -> Option<&LibCell> {
20        self.cells.iter().find(|c| c.name == name)
21    }
22}